Futurebasic/Language/Reference/bit

Function
✔ Appearance ✔  Standard ✔  Console

Syntax
bitValue = bit( bitPos )

Description
This function returns an integer whose binary representation has the bit in position  set to "1", and all other bits set to "0". Bit positions are counted from right to left: a  value of zero corresponds to the rightmost ("least significant") bit. The maximum allowable value for  is 31, which corresponds to the leftmost bit in a long-integer value. is useful in conjunction with "bitwise operators" like  and , for setting and testing the values of particular bits in a quantity.

Example
The following expression evaluates as  (-1) if bit "n" is set in  : ( testValue&amp; and bit( n ) ) &lt;&gt; 0 The following assignment sets bit "n" in  to 1: testValue&amp; = ( testValue&amp; or bit( n ) ) The following assignment resets bit "n" in  to 0: testValue&amp; = ( testValue&amp; and not bit( n ) )