Set Bit

Sets the value of a bit in an integer.


value = Set Bit (baseValue,bit,bitValue)


In TNT Basic, all integers are actually just composed of 32 individual 'bits', a bit can be either a '0' or a '1'.

This command takes a number, baseValue, and sets the specified bit to the value of bitValue.

If bitValue is 0 then the bit is set to 0, if bitValue is anything else then the bit is set to 1.

The value returned is the value of baseValue with the specific bit set.

It is possible to test if an individual bit is set using the function Bit Set.

Table of contents