Skip to content

Commit eea49c9

Browse files
committed
Día 8: Go
1 parent 46d4989 commit eea49c9

File tree

8 files changed

+167
-10
lines changed

8 files changed

+167
-10
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Rust ###
2+
# Generated by Cargo
3+
# will have compiled files and executables
4+
debug/
5+
target/
6+
7+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
8+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
9+
Cargo.lock
10+
11+
# These are backup files generated by rustfmt
12+
**/*.rs.bk
13+
14+
# MSVC Windows builds of rustc generate these, which store debugging information
15+
*.pdb
16+
17+
### rust-analyzer ###
18+
# Can be generated by other build systems other than cargo (ex: bazelbuild/rust_rules)
19+
rust-project.json

08 - Go/hello_world.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Día 8: Go
2-
// Clase en vídeo: https://www.twitch.tv/videos/1852979951?t=00h22m39s
2+
// Clase en vídeo: https://youtu.be/AGiayASyp2Q
33

44
// Creación de módulo: go mod init main
55
package main

09 - Rust/hello_world/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "hello_world"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[[bin]]
7+
path = "src/hello_world.rs"
8+
name = "Hola Rust"
9+
10+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
11+
12+
[dependencies]
624 KB
Binary file not shown.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// Día 9: Rust
2+
// Clase en vídeo: https://www.twitch.tv/videos/1864964633?t=00h20m16s
3+
4+
// Creación del proyecto: cargo new hello_world
5+
6+
use std::collections::{HashMap, HashSet};
7+
8+
fn main() {
9+
/*
10+
Esto es un comentario
11+
*/
12+
13+
// Hola mundo
14+
println!("Hola, Rust!");
15+
16+
// Variables
17+
let mut my_string: &str = "Esto es una cadena de texto";
18+
println!("{my_string}");
19+
my_string = "Aquí cambio el valor de la cadena de texto";
20+
println!("{my_string}");
21+
22+
// my_string = 6; Error
23+
24+
let my_string2: String = String::from("Esta es otra cadena de texto");
25+
println!("{my_string2}");
26+
27+
let mut my_int = 7;
28+
my_int = my_int + 4;
29+
println!("{my_int}");
30+
println!("{}", my_int - 1);
31+
println!("{my_int}");
32+
33+
println!("Este es el valor de la variable my_int: {}", my_int);
34+
35+
let my_int64: i64 = 7;
36+
println!("{my_int64}");
37+
38+
let my_float = 6.5;
39+
println!("{my_float}");
40+
// my_float = my_float + my_int; // Error
41+
42+
let my_float2: f32 = 6.5;
43+
println!("{my_float2}");
44+
45+
let mut my_bool = false;
46+
println!("{my_bool}");
47+
my_bool = true;
48+
println!("{my_bool}");
49+
50+
// Constantes
51+
const MY_CONST: &str = "Mi propiedad constante";
52+
println!("{MY_CONST}");
53+
54+
// Control de flujo
55+
if my_int == 10 && my_string == "Hola" {
56+
println!("El valor es 10")
57+
} else if my_int == 11 || my_string == "Hola" {
58+
println!("El valor es 11")
59+
} else {
60+
println!("El valor no es 10 ni 11")
61+
}
62+
63+
// Lista
64+
let mut my_list = vec!["Brais", "Moure", "@mouredev"];
65+
my_list.push("Brais");
66+
println!("{:?}", my_list);
67+
println!("{}", my_list[1]);
68+
69+
// Sets
70+
let mut my_set: HashSet<&str> = vec!["Brais", "Moure", "@mouredev"].into_iter().collect();
71+
my_set.insert("Brais");
72+
println!("{:?}", my_set);
73+
74+
// Mapas
75+
let mut my_map: HashMap<&str, i32> = vec![("Brais", 36), ("Mabequily", 45), ("Demegorash", 96)]
76+
.into_iter()
77+
.collect();
78+
my_map.insert("lemi_n_n", 26);
79+
println!("{:?}", my_map);
80+
81+
// Bucles
82+
for value in &my_list {
83+
println!("{}", value);
84+
}
85+
86+
for value in &my_set {
87+
println!("{}", value);
88+
}
89+
90+
for (key, value) in &my_map {
91+
println!("{} {}", key, value);
92+
}
93+
94+
let mut my_counter = 0;
95+
while my_counter < my_list.len() {
96+
println!("{}", my_list[my_counter]);
97+
my_counter += 1;
98+
}
99+
100+
// Funciones
101+
my_function();
102+
103+
// Estructuras
104+
let my_struct = MyStruct::new("Brais", 36);
105+
println!("{} {}", my_struct.name, my_struct.age)
106+
}
107+
108+
fn my_function() {
109+
println!("Esto es una función");
110+
}
111+
112+
struct MyStruct {
113+
name: String,
114+
age: i32,
115+
}
116+
117+
impl MyStruct {
118+
fn new(name: &str, age: i32) -> MyStruct {
119+
MyStruct {
120+
name: String::from(name),
121+
age,
122+
}
123+
}
124+
}

Media/next.jpg

-11.3 KB
Loading

Media/rust.jpg

193 KB
Loading

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,26 @@ Así con cada uno de los lenguajes.
9595

9696
### <a href=""><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/go/go-original-wordmark.svg" style="height: 3%; width:3%;"/></a> Día 8: Go
9797

98-
<a href="https://www.twitch.tv/videos/1852979951?t=00h22m39s"><img src="./Media/go.jpg" style="height: 50%; width:50%;"/></a>
98+
<a href="https://youtu.be/AGiayASyp2Q"><img src="./Media/go.jpg" style="height: 50%; width:50%;"/></a>
9999

100-
#### [Clase en vídeo](https://www.twitch.tv/videos/1852979951?t=00h22m39s) y [Código](./08%20-%20Go)
100+
#### [Clase en vídeo](https://youtu.be/AGiayASyp2Q) y [Código](./08%20-%20Go)
101101

102102
**Recursos:** [Web oficial](https://go.dev) | [Editor en línea](https://go.dev/play/) | [Configuración](https://go.dev/doc/install) | [Documentación](https://go.dev/doc) | [Tutorial](https://go.dev/learn) | [Tutorial Microsoft](https://learn.microsoft.com/es-es/training/paths/go-first-steps/)
103103

104-
### <a href=""><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/rust/rust-plain.svg" style="height: 3%; width:3%;"/></a> Día 9: Rust `PRÓXIMA CLASE`
104+
### <a href=""><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/rust/rust-plain.svg" style="height: 3%; width:3%;"/></a> Día 9: Rust
105105

106-
<a href="https://www.twitch.tv/mouredev"><img src="./Media/next.jpg" style="height: 50%; width:50%;"/></a>
106+
<a href="https://www.twitch.tv/videos/1864964633?t=00h20m16s"><img src="./Media/rust.jpg" style="height: 50%; width:50%;"/></a>
107+
108+
#### [Clase en vídeo](https://www.twitch.tv/videos/1864964633?t=00h20m16s) y [Código](./09%20-%20Rust)
107109

108-
#### Clase en directo: Jueves 6 de Julio en [Twitch](https://twitch.tv/mouredev) a las 20:00 CEST
109-
> ##### Consulta el horario por país y añade un recordatorio desde [Discord](https://discord.gg/mouredev?event=1121720570489339915)
110+
**Recursos:** [Web oficial](https://www.rust-lang.org/es/) | [Editor en línea](https://play.rust-lang.org/) | [Configuración](https://www.rust-lang.org/es/learn/get-started) | [Documentación](https://www.rust-lang.org/es/learn) | [Tutorial](https://doc.rust-lang.org/rust-by-example/) | [Libro](https://github.com/Phosphorus-M/rust-book-es)
110111

111-
### Día 10: PHP
112+
### <a href=""><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/php/php-original.svg" style="height: 3%; width:3%;"/></a> Día 10: PHP `PRÓXIMA CLASE`
112113

113-
<a href=""><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/php/php-original.svg" style="height: 10%; width:10%;"/></a>
114+
<a href="https://www.twitch.tv/mouredev"><img src="./Media/next.jpg" style="height: 50%; width:50%;"/></a>
114115

115-
> ##### Clase en directo: Próximamente...
116+
#### Clase en directo: Jueves 18 de Julio en [Twitch](https://twitch.tv/mouredev) a las 18:00 CEST
117+
> ##### Consulta el horario por país y añade un recordatorio desde [Discord](https://discord.gg/mouredev?event=1126833328864100464)
116118
117119
#### ¿Y después? Todo dependerá del interés de la comunidad...
118120

0 commit comments

Comments
 (0)