Skip to content

Implement loop labels #4

@cernec1999

Description

@cernec1999

Loop labels exist in GS2. They indicate to the VM where to jump to in break or continue statements. This is mainly useful if we have multiple loops, but we want to indicate which one to break / continue on:

function onCreated() {
    outer:
    for(temp.i = 0; temp.i < 5; temp.i++) {
        for(temp.x = 0; temp.x < 5; temp.x++) {
            if (temp.i == 3 && temp.x == 3) {
                continue outer;
            } else {
                echo(temp.i SPC temp.x);
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions