Labels

Not all features mentioned here are implemented

Labels

A label in Loop is like: <identifier>:, it serves as a "jump point". They require to be unique in the current scope.

The requirements for the identifier for a label is the same as a Variables. Here are a few examples of how a label is defined.

// Label 1
first:

// Label 2
second:

Goto

The keyword "goto" is needed to jump to a label. The syntax is as follows: goto <label>. When using a label, you need to reference a label.

if(true) {
    if (true) {
        // It will jump to the label "end_of_if"
        goto end_of_if
    }
    if (true) {
        // This block will never be reached
    }
}
end_of_if:

Last updated