How can I break a for-loop?

SutinG

Member
Reaction score
1
Hi,
I need to know how to break a for-loop. Currently I'm using a boolean flag to do this, but maybe there is an instruction defined by the editor that i've missed.

Thanks in advance.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
If it is a "For integer X do" loop then you can simply set the variable to a value outside of the upper bounds. If it is a "For integer A / B do" loop then you would need a line of jass to set those variables.
 

Inflicted

Currently inactive
Reaction score
63
I know the problem is solved, but alternatively you could just change a temporary boolean variable.
Then the functions only run if the Boolean condition is met, when you want to break. Merely change the variable, that way it will just run complete doing nothing but checking until its out of the loop. (Assuming its not infinite)
That's just a simple alternative method.
 

keychup

Active Member
Reaction score
34
What about the important part? What's the JASS line used to stop this type of loop then?

And doesn't "Skip Remaining Actions" end the loop as well?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
According to that action's tooltip, all other actions in the trigger will be skipped as well. So it's not much use if you intend to do anything after the loop.
 

Inflicted

Currently inactive
Reaction score
63
What about the important part? What's the JASS line used to stop this type of loop then?

And doesn't "Skip Remaining Actions" end the loop as well?

It surely will end the loop. But will end all other functions aswel (as said above). This is definitely not an ideal solution, unless its an emergency loop break.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top