Macro fizzbuzz::l

source ·
macro_rules! l {
    ($b:tt,$i:tt,$x:tt) => { ... };
}
Expand description

Macro to shorten boolean variable definitions

This macro is designed to shorten the definition of boolean variables ($b) to denote: “$i is divisible by $x”.

Here we use tt (TokenTree) fragment matcher to keep things succinct for Code Golf purposes, rather than other more appropriate syntactical fragment matchers.

The equivalent generated Rust code for l!(a,i,3) would be:

let a=i%3<1;