• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[JASS] A really stupid loop question

Status
Not open for further replies.
Level 13
Joined
Nov 22, 2006
Messages
1,260
I figured out that I don't understand completely how loops work. I saw this code:

JASS:
loop
    exitwhen i == 11
    call TriggerRegisterPlayerEvent(gg_trg_AI, Player(i), EVENT_PLAYER_LEAVE)
    set i = i + 1
endloop


Which was supposed to register the event for players 0-11, but doesn't this loop end when integer "i" reaches 11? Meaning, won't the loop now register the event only for players 0-10? The loop checks exitwhen always at the beginning of the loop, right? Would it make any difference if I put the exitwhen somewhere else?

Good I'm embarassed....... :)
 
Status
Not open for further replies.
Top