No BREAK statements when working with For-Loop?

Is it possible to easily break from a for-loop after a certain criteria is met, like finding a specific ID or name?

Normally I would use something like a BREAK statement or even CONTINUE depending on the context, but I can’t see to find something like this in verse (break is limited to LOOP)

I did a workaround, like (if value found is X, set a logic operator Y to TRUE. If Y= true, stop executing stuff at the end of the loop, until the iterations are done) or even using a LOOP instead of for-loop.

Here you go :smiley:

var IsHolding : logic = false
loop:
    for(Weapon : ForbiddenWeapons, Weapon.IsHoldingItem[Player]):
        set IsHolding = true
        break
    break

That’s the only way to do that for now

1 Like