Purpose 
Return the value of a particular bit in an

Syntax 
flag = BIT(intvar, bitnumber) 
Remarks 
The BIT function is used to determine the value of one particular bit in an integralclass variable or implied bitarray. 
intvar 
The parameter intvar must be a variable, not an expression. The BIT function returns either 0 or 1 to indicate the value of the specified bit. 
bitnumber 
The bit in question. The allowable range for the parameter is the same as that of a Longinteger. This makes it possible to have implicit bitarrays of more than 2 billion bits in size. For such arrays, bits 0 to 15 are in the first word starting at intvar, bits 1631 are in the next word, and so forth. Implied bitarrays are considered to start at the memory position of the variable intvar. For example, if intvar is itself an array variable, it is possible to access bits in any of the following elements of the array. See the array examples below. Care must be exercised to ensure that the bit index number (bitnumber) does not exceed the number of bits that can be validly accessed. For example, reading the 17th bit of a 16bit scalar variable may trigger a General Protection Fault (GPF). Similarly, adjusting the 4097th bit of a bitarray derived from a 128element DWORD array may cause similar problems. bitnumber is always zerobased, so the 129th bit of an implied bitarray is referenced in the BIT statement with bitnumber equal to 128. For example: x& = BIT(A?(1), 128). The first bit is the leastsignificant bit, which is bit number zero. For example: 
See also 
BIT CALC statement, BIT statement, BITS functions 
Example 
x% = 7 y% = BIT(x%, 2) [statements] DIM z%(1:2000000) ' 32 million element bitarray y% = BIT(z%(1),16) ' bit 0 of 2nd word of z%() y% = BIT(z%(2000000),15) ' MSB of last element y% = BIT(z%(1), 31999999&) ' MSB of last element 