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