errors and warnings / parsing / E0106
E0106 error
continue or break outside a loop
- area
- parsing (x01xx)
- fails the build
- yes
A break or continue is not inside a loop of the same function. Both only
leave or restart the innermost while, repeat or for loop; a loop around
the function that contains them doesn't count. Use return to leave a
function early.
Example
local function onEvent(event: string) if event ~= "PLAYER_LOGIN" then break end print("logged in")endonEvent("PLAYER_LOGIN")local function onEvent(event: string) if event ~= "PLAYER_LOGIN" then return end print("logged in")endonEvent("PLAYER_LOGIN")The compiler reports it like this:
error[E0106]: no loop to break near 'end' ┌─ src/main.wowlua:3:9 │ 3 │ break │ ^^^^^ here
Related codes
| code | message |
|---|---|
| E0114 | continue is not the last statement of its block |
Offline
$ wowlua explain E0106 E0106 (error): continue or break outside a loop