Each bit in a variable can be addressed individually using bitwise operators, but there is an easier way: a special syntax for accessing bits. (It is especially handy for coding dialogs.)

Each variable has 32-bits, which are indexed 0 to 31, and can be accessed as if they were an array of 32 logical values.


var flags;

flags.bit[4] = false;         // clear bit 4
flags.bit[5] = true;          // set bit 5
flags.bit[6] = !flags.bit[6]; // toggle bit 6
flags.bit[5] = z < 100;       // store any logial value

if flags.bit[10] {  // test bit 10
     doSomethingAboutIt;
}

[This syntax is not allowed on variables inside and array.]

See Also...