exitwhen syntax error

shadowcon

New Member
Reaction score
4
JASS:
    loop
        exitwhen loccheck = true
        if (pushbackedMinus250 == GetUnitLoc(GetEnumUnit())) then
            set loccheck = true
        else
            call MoveUnitBack()
        endif
    endloop


I get a syntax error in newgen from this, in the exitwhen line i tried changing it to
JASS:
exitwhen (loccheck = true)

but it didnt help, so im kinda stuck on this, could some1 help me out? :)
 

UndeadDragon

Super Moderator
Reaction score
447
I haven't JASSed in a while, but in most programming languages it would be

[ljass]loccheck == true[/ljass]
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Setting a boolean in order to exit the loop.. Whaha, brings me back to the good ol'days.

JASS:
loop
    if <statement> then
        // Do stuff
        exitwhen true
    endif
endloop
 

ZugZugZealot

New Member
Reaction score
33
To spare yourself typing and cluttery code, you can just do...
JASS:
exitwhen loccheck


exitwhen takes a boolean, and needs true to exit. loccheck on its own is a boolean so you can just use that. And if you wanted it to exit when loccheck is false then you can do...
JASS:
exitwhen not loccheck

[ljass]not[/ljass] converts false to true and true to false.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top