Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

BITTEST

Description

The BITTEST function may be used to test the bit number of the integer specified by expression. It takes the general from: 

BITTEST(expression, bit#

Where: 

expression must evaluate to an integer. If expression evaluates to the null value, null is returned. 

If bit# evaluates to null, the BITTEST function fails and the program terminates with a run-time error message.


The function returns 1 if the bit is set; it returns 0 if it is not; Bits are counted from right to left. The number of the rightmost bit is 0. Non integer values are truncated before the operation is performed.

An example of use is as: 

PRINT BITTEST(11,0),BITTEST(11,1),BITTEST(11,2),BITTEST(11,3)
* The binary value of 11 = 1011

to output:
1 1 0 1


Go back to jBASE BASIC.

Was this article helpful?