Skip to content

Commit 80c0c1c

Browse files
committed
add func_match function to prac12 module for number matching
1 parent 9ec07a8 commit 80c0c1c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/prac12.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,18 @@ fn main(){
99
else{
1010
println!("number is equal to 10");
1111
}
12+
func_match();
13+
}
14+
15+
fn func_match(){
16+
let number:u8 = 3;
17+
match number{
18+
0 => println!("number is 0"),
19+
1 => println!("number is 1"),
20+
2 => println!("number is 2"),
21+
3 => println!("number is 3"),
22+
4 => println!("number is 4"),
23+
5 => println!("number is 5"),
24+
_ => println!("number is not 0-5")
25+
}
1226
}

0 commit comments

Comments
 (0)