iflet
This commit is contained in:
@@ -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
8
iflet/Cargo.toml
Normal 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
14
iflet/src/main.rs
Normal 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user