AND is not a boolean operator in Blitz, it is a bitwise operator.
The bitwise operator in Blitz are:
Xor, Or, And, Not
The reason that AND (OR, XOR, and NOT also work) works in IF statements is shown in the examples below:
The commented IF lines in each example are identical to the the uncommented one. And if you hadn't figured it out, the one's and zeros with percent signs in front are binary.
In example 1, everything is fine because it is a simple addition equation.
But example 2 gives the error that many people do not expect. The commented lines (hopefully) explain why.
Example 3 is the corrected version of example 2.
The bitwise operator in Blitz are:
Xor, Or, And, Not
The reason that AND (OR, XOR, and NOT also work) works in IF statements is shown in the examples below:
;Example 1: x=12 ;%1100 y=3 ;%0011 If x + y Then dostuff ;If 12 + 3 Then dostuff ;If 15<>0 Then dostuff ;If %1111<>%0000 Then dostuff ;Example 2: x=12 ;%1100 y=3 ;%0011 If x And y Then dostuff ;If 12 And 3 Then dostuff ;If %1100 And %0011 Then dostuff ;If %0000<>%0000 Then dostuff ;Example 3: x=12 ;%1100 y=3 ;%0011 If (x<>0) And (y<>0) Then dostuff ;If (12<>0) And (3<>0) Then dostuff ;If (%1100<>%0000) And (%0011<>%0000) Then dostuff ;If %0001 And %0001 Then dostuff
The commented IF lines in each example are identical to the the uncommented one. And if you hadn't figured it out, the one's and zeros with percent signs in front are binary.
In example 1, everything is fine because it is a simple addition equation.
But example 2 gives the error that many people do not expect. The commented lines (hopefully) explain why.
Example 3 is the corrected version of example 2.