Expressions and starting flow control in RBE
This commit is contained in:
17
rustbyexample/flow_control.d/while.rs
Normal file
17
rustbyexample/flow_control.d/while.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
fn main() {
|
||||
let mut n = 1;
|
||||
|
||||
while n < 101 {
|
||||
if n % 15 == 0 {
|
||||
println!("fizzbuzz");
|
||||
} else if n % 3 == 0 {
|
||||
println!("fizz");
|
||||
} else if n % 5 == 0 {
|
||||
println!("buzz");
|
||||
} else {
|
||||
println!("{}", n);
|
||||
}
|
||||
|
||||
n += 1;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user