- Joined
- Dec 12, 2010
- Messages
- 2,074
What ya think will return
??
Jass says "false", because just as soon as it met "[false] and" statement without additional brackets it drops whole chunk (or at least it looks like this).
While in normal languages, including C++ and JS,
equal to true
This behaviour is counter-intuitive and shouldn't exist
Test map attached. It's code:
JASS:
return false and true or true
Jass says "false", because just as soon as it met "[false] and" statement without additional brackets it drops whole chunk (or at least it looks like this).
While in normal languages, including C++ and JS,
Code:
false && true || true
Code:
#include <stdio.h>
int main(void)
{
if(0 && 1 || 1) printf("correct");
else printf("bad");
}
This behaviour is counter-intuitive and shouldn't exist
Test map attached. It's code:
JASS:
function asdasd takes nothing returns nothing
if false and true or true then
call BJDebugMsg("passed [false and true or true]")
else
call BJDebugMsg("[false and true or true] == false")
endif
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerAddAction(t,function asdasd)
call TriggerRegisterTimerEvent(t,1,true)
endfunction