Zoomscript current supports 4 control structures:
Nested loops are currently not supported.
Repeat loop
Repeat loops are identified by the following format:
repeat [integer] [Code block]endrepeatRepeat loops require an integer value. If the value is 0 or less, the loop will still run once.
Repeat loops also support variable values. If the value isn't an integer, the loop will still run once.
While loop
While loops are identified by the following format:
while [expression] [Code block] endwhileWhile loops require a boolean expression. The expression must be true or false. If the expression is not a boolean, your program will crash with a ControlError. While loop expressions support variables and function calls as parameters. Functions must return a boolean value.
If statement
If statements are identified by the following format:
if [expression] [Code block]endifIf statements require a boolean expression. The expression must be true or false. If the expression is not a boolean, your program will crash with a ControlError. Similar to while loop expressions, variables and function calls are supported as parameters.
If else statements
The same as if statements, but with a secondary 'else' code block:
if [expression] [Code block]else [Code block]endifContinuous if-else statements are not supported. Use nested if-statements instead.