From 341f8b46bf04212af863b39b6c1986b2e9383366 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 22 Mar 2020 19:16:47 +0800 Subject: [PATCH] add while --- single_file_tests/while.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 single_file_tests/while.rs diff --git a/single_file_tests/while.rs b/single_file_tests/while.rs new file mode 100644 index 0000000..4fec0c6 --- /dev/null +++ b/single_file_tests/while.rs @@ -0,0 +1,24 @@ + +fn main() { + let mut cnt = 0_u32; + while cnt < 10 { + print!("{} ", cnt); + cnt += 1; + } + println!(""); + + for i in 0..10 { + print!("{} ", i); + } + println!(); + + for i in 0..=10 { + print!("{}", i); + match i { + _ if i % 2 == 0 => print!("[ORD]"), + _ => (), + } + print!(" "); + } + println!(); +} \ No newline at end of file