Control statements form blocks which contain standard SQL and MetaSQL tags. While control statements are not directly responsible for producing output, they do determine whether their contents should be outputted or not. The complete list of available MetaSQL control statements is described below:
Use the if
statement to begin a conditional control block. One token should follow this opening statement. You can reverse the boolean result of a token by placing a not
token directly proceeding the token. If the token is a true
value, then the contents of the if
block will be executed. If the condition is false
, then the next following elseif
condition will be evaluated, assuming one exists.
Place an elseif
statement within an if
block to divide the if
block into multiple blocks. An elseif
statement behaves in the same manner as an if
statement. Any number of elseif
conditions may be included within an if
block.
An else condition, if present, is executed when both the if
condition and any elseif
conditions are false. At most, there may be one else
condition included within an if
block.
Use this statement to end an if
block.
This statement operates on the parameter which immediately follows it. If the parameter represents a list of values, the foreach
block will be executed once for each value in the list. If the parameter represents a single value, then the block will be executed once. If no values exists, the block will not be executed.
Use this statement to end a foreach
block.