macro_rules! do_while {
($code:block, $cond:expr) => { ... };
}
Expand description
A Rust implementation of the C do while
loop
§Examples
§Fizz Buzz
let mut i = 1;
do_while!(
{
if i % 15 == 0 {
println!("fizzbuzz");
} else if i % 3 == 0 {
println!("fizz")
} else if i % 5 == 0 {
println!("Buzz");
} else {
println!("{i}");
}
i += 1;
},
i < 101
)