Overview of Conditional Statements¶
IF executes a block when a condition is true. UNLESS is its negative form
and executes a block when the condition is false.
Conditions use BOOL. For a pointer or another type with an affirmative state,
write the booliation test explicitly:
Alternative selection¶
ELSE IF, ELSE UNLESS, and a final ELSE form a conditional chain:
Conditions are checked from left to right. Only the first selected branch executes. Variables declared inside a branch are local to that branch, so declare an output before the chain when later code needs it.
Branch likelihood¶
Place LIKELY or UNLIKELY after IF or UNLESS and before the condition:
The hint describes the likelihood of entering that statement's first block.
For UNLESS, that is the block entered when its condition is false. Hints
inform optimization and do not change evaluation or branch semantics.
Reference¶
See the Conditional Statements Reference
for conversion to BOOL, exact chain evaluation, branch scope, lifetime-state
convergence, and the distinction from STATIC_IF, MATCH, and INCLUDE_IF.