fn test_match(){
let scores=80;
match scores{
x if x>=80 => println!("excellent"),
x if x>=60 => println!("good"),
_ => println!("bad")
}
}
fn test_match_v2()->&'static str{
let scores=80;
match scores{
80..100 => "excellent",
60..80 => "good",
_ => "bad"
}
}
Rust 条件分支匹配
于 2025-10-08 06:42:01 首次发布
5万+

被折叠的 条评论
为什么被折叠?



