In the Operator Precedence documentation page, you can see that the '= (equal)' operator (do not confuse with the assignment operator) has a precedence higher than the 'And' operator.
So: 'if myByte and 8 = 8 then'
is parsed as: 'if (myByte) and (8 = 8) then'.
To go against the operator precedence, you must insert parentheses: 'if (myByte and 8) = 8 then'
You can also replace "and" with "AndAlso" (that is more appropriate, in such a situation, actually)
Original BASIC used bitwise AND as logical AND, as well, and it didn't make a real difference because it was supposed to work mostly with variable comparisons. But when used with function results, using logical or bitwise operator produces different results
angros47 wrote: ↑Feb 02, 2024 18:40
You can also replace "and" with "AndAlso" (that is more appropriate, in such a situation, actually)
Original BASIC used bitwise AND as logical AND, as well, and it didn't make a real difference because it was supposed to work mostly with variable comparisons. But when used with function results, using logical or bitwise operator produces different results