elseif

Defines a conditional execution path for an if block.

Syntax

elseif(expr)

Input

expr

A mathematical control expression. If expr evaluates to zero, the expression is false. If expr evaluates to any other value, the expression is true.

Example

Template:
{numer = 5}
{denom = 0}

{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 denominator is 0, so a result is impossible.

Comments

An elseif condition is evaluated only when a preceding if condition has been evaluated as false. An if block can contain any number of elseif statements. Each elseif is evaluated in turn until a true condition results, or an else or endif statement is encountered.

If an elseif condition is evaluated as true, the statements following the elseif are executed until an else or endif statement is encountered.