Skip to content

Add continue to loops #31

Description

@NightmarePog

`break` works but `continue` doesn't exist yet. Without it you end up nesting the rest of your loop body inside an `if`:

```
for i = 0, n {
if should_skip(i) {
// have to nest everything here
process(i)
do_more(i)
}
}
```

With `continue` that becomes:

```
for i = 0, n {
if should_skip(i) { continue }
process(i)
do_more(i)
}
```

Lua doesn't have `continue` natively but it can be lowered to `goto` — the same way most languages that compile to Lua handle it. Should be a straightforward addition to the parser and codegen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions