Skip to content

7. Control Flow

OJddJO edited this page Nov 8, 2024 · 18 revisions

Note

Control flow statements are used to control the flow of the program. They are used to make "decisions" and to repeat code blocks.

Conditional Statements

Note

Conditional statements are used to make decisions in the code. They evaluate a boolean expression and execute a block of code if the expression is true.

Expression Description
if <boolean expression> If the <boolean expression> is verified (example: a less b)
elif <boolean expression> Else the <boolean expression> is verified
else Else
endif End if

Loops

Important

For loops aren't implemented yet, I believe you can do it with infloop for now :)

Note

Loops are used to repeat code blocks. There are two types of loops: for loops and while loops. break can be used to stop a loop.

Expression Description
infloop Loop infinitly (to use it properly, a break must be used (turn this into a while loop))
endinf End infloop
break Break loop
continue Skip until the/Continue to next iteration
for i from 1 to 10 Loop from 1 to 10
for i from 1 to 10 step 2 Loop from 1 to 10 with a step of 2
for i from 10 to 1 step -1 Loop from 10 to 1 with a step of -1
endfor End for loop

-> Next: Functions
Return to main page