Expressions and starting flow control in RBE
This commit is contained in:
23
rustbyexample/flow_control.d/loop.rs
Normal file
23
rustbyexample/flow_control.d/loop.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
fn main() {
|
||||
let mut count = 0u32;
|
||||
|
||||
println!("Let's count until infinity!");
|
||||
|
||||
loop {
|
||||
count += 1;
|
||||
|
||||
if count == 3 {
|
||||
println!("three");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
println!("{}", count);
|
||||
|
||||
if count == 5 {
|
||||
println!("OK, that's enough");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user