Author Topic: If statement not evaluating correctly  (Read 429 times)

Code: [Select]
!(%tr $= %mem.lastTR && %ev $= %mem.lastEV) && %mem.lastTR && %mem.lastEV is evaluated as false

Code: [Select]
!(%tr $= %mem.lastTR && %ev $= %mem.lastEV)
%mem.lastTR
%mem.lastEV
are all separately evaluated as true

Code: [Select]
echo("-----" NL (!(%tr $= %mem.lastTR && %ev $= %mem.lastEV) ? "True" : "False") NL (%mem.lastTR ? "True" : "False") NL (%mem.lastEV ? "True" : "False") NL ((!(%tr $= %mem.lastTR && %ev $= %mem.lastEV) && %mem.lastTR && %mem.lastEV) ? "True" : "False") NL "------");Prints out
------
True
True
True
False
------


Someone tell me what im missing please
« Last Edit: June 25, 2012, 02:37:58 PM by DYLANzzz »

I have a feeling it has something to do with that 'not' at the beginning of the statement

Try (%tr !$= %mem.lastTR || %ev !$= %mem.lastEV) as a replacement for the first one, if I'm reading this correctly it should work the same as !(%tr $= %mem.lastTR && %ev $= %mem.lastEV)

Nope, still getting the same thing, all evaluate as true except for the full statement

So apparently
Code: [Select]
%mem.lastTR && %mem.lastEVevaluates to false so the problem is coming from this bit.
Can anyone explain to me why? (each also evaluate to true separately)

FIXED IT
Code: [Select]
(%mem.lastTR ? 1 : 0) && (%mem.lastEV ? 1 : 0)ended up doing this and now it works
« Last Edit: June 25, 2012, 05:45:43 PM by DYLANzzz »

FIXED IT
Code: [Select]
(%mem.lastTR ? 1 : 0) && (%mem.lastEV ? 1 : 0)ended up doing this and now it works

For something simpler, try (%mem.lastTR) && (%mem.lastEV).