macro_rules! do_while { ($body:block while $condition:expr) => { ... }; }
Expand description
Do-while loop.
ยงExamples
let mut i = 0;
let mut n = 0;
do_while!({
n += i;
i += 1;
} while i < 5);
assert_eq!(n, 10);
The loop always executes at least once.
let mut ran = false;
do_while!({ ran = true } while false);
assert!(ran);