OR ???

Blitz3D Forums/Blitz3D Programming/OR ???

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Wow, thanks for the post Mark!

For the ones that come froms C/C++ by example, it may be worth mentioning that because And & Or are bitwise operators (there is no logical And & Or in Blitz), you can't safely do like in C:
if (i && j) {...// do something if i & j are not 0

because in Blitz doing
If i And j Then ...
will do something if the bitwise and of i & j is not null, which is not the same. it's like using the '&' operator in C rather than '&&'. So always be explicit and do
If i<>0 And j<>0 Then..


Also is worth mentioning that Not, unlike And & Or, is a logical operator and not a bitwise operator: (Not 1) is 0 rather than $fffffffe. To do a bitwise Not, use Xor:
(1 Xor $ffffffff) = 1 "bitwise noted" = $fffffffe.