Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Curso Básico de Rust: Variables, Ciclos y Funciones #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ LISTA DE CURSOS

- [Curso de C# con .Net Core](c_con_net.md)
- [Curso de Introducción a Java SE](java_se.md)
- [Curso Básico de Rust: Variables, Ciclos y Funciones](basic_rust.md)

**Mobile**

Expand Down
43 changes: 43 additions & 0 deletions basic_rust.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
1. Para crear un nuevo proyecto en Rust, el comando es:

cargo new hello_world

2. Las variables en Rust son por defecto:

Inmutables

3. Para imprimir la variable "x" en la pantalla se usa el comando:

```rust
println!("{}", x);
```

4. Para importar una dependencia en nuestro código, usamos la sintaxis:

```rust
use regex::Regex;
```

5. Para saber si "x" es mayor a 10, la sintaxis es:

```rust
if x > 10 { println!("Puedes entrar a la discoteca"); }
```

6. El ciclo loop se usa cuando:

Se tiene código repetitivo que puede o no ser infinito.

7. Las funciones se usan cuando:

Se quiere utilizar en varias partes un mismo código.

8. Las referencias de nuestro proyecto se agregan a:

```console
Cargo.toml
```

9. Una estructura permite:

Es una forma de agrupar una cantidad de valores diferentes en un solo objeto.