-
Notifications
You must be signed in to change notification settings - Fork 3
Loops
Franco Montenegro edited this page May 25, 2016
·
3 revisions
while (someCondition)
// ...
endwhile
The break statement is just a translated version of exitwhen true
.
local integer i = 0
loop
set i = i + 1
exitwhen i > 5
if i == 3 then
continue
endif
if i == 5 then
continue
endif
call BJDebugMsg(I2S(i))
endloop
continue
will ignore the iterations where i
is equal to 3 and 5. Therefore, the message will be: 1, 2 and 4.
It also works in while loops.
Do keep in mind that this can lead to infinite loops if for example we move set i = i + 1
to the bottom (since i
will eventually be 3 and we will skip the rest from there).