- Joined
- Sep 5, 2019
- Messages
- 33
Hey all, Im just learning jass and am struggling to make a loop work. Im wondering if there can be 2 conditions for exitwhen?
using AND, or OR.
Example:
Function Fxn takes nothing returns nothing
local integer a = 1
local integer b = 5
loop
exitwhen a == 1 AND b == 1
set b = b-1
endloop
endfunction
I know its possible with other coding languages, and even found a tutorial on jass (Basic JASS Tips) that says it works. However, I cant make it work. This is the condition im trying to make work:
exitwhen ((udg_KeyLeftOn == false) OR (TimerGetRemaining(Reset) <= 0))
But Ive also tried much simpler ones, in loops, if/then statements, testing different placements of the parentheses and the OR itself, and different capitalization/lowercase of the OR. Ive also spent multiple hours looking for a thread or forum on this, and haven't found anything other than the tut above (which isn't clear enough for me apparently, since I cant make it work. I DO NOT HAVE vJass, which im beginning to think may be the problem. If anyone can tell me why this isnt working, or suggestions to fix it or a different way, Id appreciate it. I have thought about using a different function to set a global boolean variable to true if both conditions are true. If I cant figure this out, Ill just do that, even though it would be a bit slower, but mostly this is all because I want to understand jass better. Thank you!
using AND, or OR.
Example:
Function Fxn takes nothing returns nothing
local integer a = 1
local integer b = 5
loop
exitwhen a == 1 AND b == 1
set b = b-1
endloop
endfunction
I know its possible with other coding languages, and even found a tutorial on jass (Basic JASS Tips) that says it works. However, I cant make it work. This is the condition im trying to make work:
exitwhen ((udg_KeyLeftOn == false) OR (TimerGetRemaining(Reset) <= 0))
But Ive also tried much simpler ones, in loops, if/then statements, testing different placements of the parentheses and the OR itself, and different capitalization/lowercase of the OR. Ive also spent multiple hours looking for a thread or forum on this, and haven't found anything other than the tut above (which isn't clear enough for me apparently, since I cant make it work. I DO NOT HAVE vJass, which im beginning to think may be the problem. If anyone can tell me why this isnt working, or suggestions to fix it or a different way, Id appreciate it. I have thought about using a different function to set a global boolean variable to true if both conditions are true. If I cant figure this out, Ill just do that, even though it would be a bit slower, but mostly this is all because I want to understand jass better. Thank you!