Macro mac::do_while [] [src]

macro_rules! do_while {
    ($body:block while $condition:expr) => { ... };
}

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);