if

Begins an if block.

Syntax

if(expr)

Input

expr
A mathematical control expression. If expr evaluates to zero, the expression is false and the instruction following the else or endif statement is executed. If expr evaluates to any other value, the expression is true and the instructions between the if statement and either the elseif, else, or endif statement is executed.

Example

Example 1
Template:
{numer = 5}
{denom = 4}
 
{if(numer == 0)}
 The numerator is 0, so the 
 result is 0.
{elseif(denom == 0)}
 The denominator is 0, so a
 result is impossible.
{else}
 The result is: {numer/denom}.
{endif}
Output:
The result is: 1.25.
Example 2
Template:
{x = 5; y = 4}
{if(x % y) }
 The remainder is {x % y}.
 {else}
 {x} is a multiple of {y}.
 {endif}
Output:
The remainder is 1.

Comments

Additional branches can be added to an if block using elseif and else statements.

if blocks can be nested to any depth. Every if block must be terminated with an endif statement.