BITSET function

Syntax

BITSET (expression, bit#)

Description

Use the BITSET function to set to 1 the bit number of the integer specified by expression. The number of the rightmost bit is 0. If the bit is 1, it is left unchanged.

If expression evaluates to the null value, null is returned. If bit# evaluates to the null value, the BITSET function fails and the program terminates with a run-time error message.

Values that are not integers are truncated before the operation is performed.

Example

PRINT BITSET(20,0),BITSET(20,3)
* The binary value of 20 = 10100
* The binary value of 21 = 10101
* The binary value of 28 = 11100
PRINT BITSET(2,0),BITSET(2,1)
* The binary value of 2 = 10
* The binary value of 3 = 11

This is the program output:

21   28
3   2