@if-@else directives can be used for conditional macro expansion. Informally, the syntax is:
@if (b1) {x1}
@elseif (b2) {x2}
@elseif (b3) {x3}
...
@elseif (bn) {xn}
@else {y}
There may be zero or more @elseif directives. The @else directive is optional. The b1,...,bn are macro expanded before being evaluated as boolean valued expressions. This for example allows for nested @if-@else expressions, such as in the following example:
Before translation | After translation |
---|---|
|
|