And can be used as a command, an operator, or as a function. It performs a logical bitwise And of two bit patterns
And ivar, j( command)
int = i And j( operator)
int = And(i, j)( function)
ivar:integer variable
i, j:integer expression
And ivar, j sets in the variable ivar the bits which are set in both ivar and value j.
i And j and(i, j) set in the result only the bits which are set in both i and j.
Print Bin$(3, 4) // Prints 0011
Print Bin$(10, 4) // Prints 1010
Print Bin$(3 And 10, 4) // Prints 0010
Print Bin$(And(3, 10), 4) // Prints 0010
Local a% = 3
And a%, 4
Print Bin$(a%, 4) // Prints 0011
The operator And is synonymous with %& and can be used instead:
Print Bin$(3 %& 10, 4) // Prints 0010
Or, Xor, Imp, Eqv, %&, |, ~, Operator Hierarchy
{Created by Sjouke Hamstra; Last updated: 23/09/2014 by James Gaite}