[−][src]Macro postfix_macros::then
Executes the body if the argument is true
Meant to be used in a postfix context, as
the postfix analog of if
.
With the bool::then
function, there is a
currently unstable
equivalent in the standard library, but
the macro doesn't put the body into a
closure, and is thus more powerful.
Evaluates the first argument as a boolean,
and if it's true
, executes the body.
let mut w = 0; for i in 1..10 { w += i; (w % i == 0).then!{ w += i * i }; } assert_eq!(w, 75);