Files

18 lines
357 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
enum Option { Some(i64), None }
fn main() -> i64 {
let s = Option::Some(42);
let n = Option::None;
// 打印 tag 值 (Some=0, None=1)
print_i64(s);
print_i64(n);
// match 判断是 Some 还是 None(只比较 tag
match s {
Option::None => { print_i64(999); }
_ => { print_i64(100); }
}
return 0;
}