Skip to content

Control Structures

TheRealMichaelWang edited this page May 6, 2021 · 1 revision

Control Structures

FastCode supports a variety of control structures to organize control flow. However, it should be kept in mind that FastCode does not implement for loops.

If...Elif...Else Blocks

if condition1 {
    do_task1()
}
elif condition 2 {
    do_task2()
}
else {
    do_task3()
}

Note: None of these method identifiers are valid ... unless you choose to define them.

or alternatively with the => notation...

if condition1 => one_statment_only()
elif condition2 => second_single_statment()
else => last_single_statement()

Note: Using the => notation only reads one statement as the body of the control structure.

While Loops

while condition {
    do_something()
}

or alternatively...

while condition => do_something

Clone this wiki locally