This commit is contained in:
2023-06-26 11:46:57 +02:00
parent 0116149495
commit f311fc4dd1
3 changed files with 23 additions and 0 deletions

View File

@@ -30,3 +30,4 @@
- https://tinchicus.com/2022/07/14/rust-struct-en-multiples-archivos/ (estructura2)
- https://tinchicus.com/2022/07/15/rust-tuple-struct/ (nuevotipo)
- https://tinchicus.com/2022/07/18/rust-enum/ (enums)
- https://tinchicus.com/2022/07/19/rust-patrones-y-coincidencias/ (iflet)

8
iflet/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "iflet"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

14
iflet/src/main.rs Normal file
View File

@@ -0,0 +1,14 @@
fn main() {
let x = 1;
match x {
1 => println!("uno"),
_ => println!("no encontrado"),
}
if let 1 = x {
println!("uno")
} else {
println!("no encontrado")
}
}