12 lines
470 B
Text
12 lines
470 B
Text
// point of interest: the when keyword and && operator inside the macro definition are macros themselves
|
|
|
|
macro if2 (cond1, cond2, bodyTT, bodyTF, bodyFT, bodyFF)
|
|
syntax ("if2", "(", cond1, ")", "(", cond2, ")", bodyTT, "elseTF", bodyTF, "elseFT", bodyFT, "else", bodyFF)
|
|
{
|
|
<[
|
|
when($cond1 && $cond2) {$bodyTT};
|
|
when($cond1 && !($cond2)) {$bodyTF};
|
|
when(!($cond1) && $cond2) {$bodyFT};
|
|
when(!($cond1) && !($cond2)) {$bodyFF};
|
|
]>
|
|
}
|