Difference between revisions of "BIT"

From QB64 Wiki
Jump to navigation Jump to search
(Created page with 'The _BIT datatype can hold only 0 and -1. If you set the variable to any other number then the least significant bit of that number will be set as the variables number, if the bi…')
 
Line 11: Line 11:
  
  
''See also:''
+
''See also:'' [[_BYTE]], [[_DEFINE]], [[DIM]]

Revision as of 00:08, 2 October 2009

The _BIT datatype can hold only 0 and -1. If you set the variable to any other number then the least significant bit of that number will be set as the variables number, if the bit is 1 (on) then the variable will be -1 and if the bit is 0 (off) then the variable will be 0.


More information:


The least significant bit is the last bit on a string of bits (11111) since that bit will only add 1 to the value if set. The most significant bit is the first bit on a string of bits and changes the value more dramatically (significantly) if set on or off.

The _BIT datatype can be succesfully used as a boolean and it requires minimal amount of memory (the lowest amount possible actually).


See also: _BYTE, _DEFINE, DIM