06-21-2017, 04:05 PM
For most cases having non 1 value for "True" doesn't matter (even in Sinclair basic, a positive value > 1 is "true)
So if you are doing
let bool=1>2
if bool then print "True" : end if
It's fine if bool=255, for logic. It's bad logic in ZX Basic to assume true=1, though. You can cast it with SGN, probably, or BAND 1 to limit it to definite 1/0 - then you aren't putting the overhead into every comparison. Your call as to which is most efficient, probably.
So if you are doing
let bool=1>2
if bool then print "True" : end if
It's fine if bool=255, for logic. It's bad logic in ZX Basic to assume true=1, though. You can cast it with SGN, probably, or BAND 1 to limit it to definite 1/0 - then you aren't putting the overhead into every comparison. Your call as to which is most efficient, probably.