Exercism:刷Rust題+學英語—26 Matching Brackets
2023-07-02 15:49 作者:CoCo不喝Coke | 我要投稿

fn main() {
???let a = [1,2,3,4,5];
???match [1..] {
???????a => println!("match slice succeed"),
???????_ => println!(" failed "),
???}
???match a{
???????[1,..] =>println!("match a succeed "),
???????_ =>println!( "failed" ) ,
???}
}
加","表示只匹配第一個元素
不加逗號,表示匹配切片
標簽: