squirreltown
12 years agoRoku Guru
If not
Is there a difference between these two statements?
if not m.motionbit = invalid
if m.motionbit <> invalid
thanks
if not m.motionbit
if m.motionbit
thanks
"squirreltown" wrote:
Is there a difference between these two statements?if not m.motionbit[x] = invalid
if m.motionbit[x] <> invalid
if not (m.motionbit[x] = invalid)
if m.motionbit[x] <> invalid
"TheEndless" wrote:
Potentially. Depends on the type of "m.motionbit". If it were a boolean, for instance, then your first statement would compare it's inverse to invalid
if (not ( ( (m.motionbit)[x] ) = invalid) ) then ...
"EnTerr" wrote:"TheEndless" wrote:
Potentially. Depends on the type of "m.motionbit". If it were a boolean, for instance, then your first statement would compare it's inverse to invalid
Nope - it does not depend at all on the value.
Operations are performed in order of precedence, as provided in TFM. In the case of if not m.motionbit= invalid then ... , dot-operator has highest priority and goes first, followed by [], followed by comparison operator, and NOT is last. In other words, it is the same as this (which by the way works too):if (not ( ( (m.motionbit)[x] ) = invalid) ) then ...
The order/precedence of the operations has been done in such a way to minimize need for parenthesis in day-to-day coding.