• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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