add match.rs
This commit is contained in:
10
single_file_tests/match.rs
Normal file
10
single_file_tests/match.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
fn main() {
|
||||||
|
let x = ["a", "b", "c", "d"];
|
||||||
|
for i in &x {
|
||||||
|
match *i {
|
||||||
|
s @ "a" | s @ "b" => println!("IS A or B: {}", s),
|
||||||
|
s if s == "c" => println!("IS C: {}", s),
|
||||||
|
s => println!("Others: {}", s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user