| 09-25-2010, 06:54 PM | #1 |
Hai guys. Lot's of questions from me recently. Thanks in advance for your help. Are the boolean operators in JASS short circuited? i.e. if (someBoolVal || funcThatReturnsBool()) If someBoolVal is true will it evaluate the second and call the function? Never mind. I realized i could test it myself. And the answer is, yes, it is short circuited. Test Code://! zinc library Test { function True() -> boolean { BJDebugMsg("true function called"); return true; } function EscActions() { if (true || True()) { BJDebugMsg("Obviously I will print"); } } function onInit() { trigger t = CreateTrigger(); TriggerRegisterPlayerEventEndCinematic(t, Player(0)); TriggerAddAction(t, function EscActions); } } Only "Obviously I will print" was displayed. |
