Control Structures
The following control structures can be used in fi:
if/else
throw
assert
We are currently working on a few additional control structures, including:
foreach
loop
If/else
If statements allow you to branch your logic in multiple ways based on the resolution of an expression. If the expression resolves as true, the code within the curly braces is executed.
else
A second block of code can be placed within curly braces after the initial block, prepended with the else control. You can also use else if to define another condition expression to evaluate.
Throw
This allows the developer to exit execution of the script - an optional value can be provided as an argument, which will be returned as an error.
Assert
The assert allows the developer to exit execution if a condition returns false - essentially the combination of an if and a throw. The first argument must be the condition to evaluate, and the optional second argument can be the value to be returned as an error. The previous example can also be written as:
Last updated