Next: , Previous: , Up: Words   [Contents][Index]


5.4 Boolean Flags

A Boolean flag is cell-sized. A cell with all bits clear represents the flag false and a flag with all bits set represents the flag true. Words that check a flag (for example, IF) will treat a cell that has any bit set as true.

True ( unknown  ) unknown “True”
False ( unknown  ) unknown “False”
on ( a-addr –  ) gforth-1.0 “on”

Set the (value of the) variable at a-addr to true.

off ( a-addr –  ) gforth-1.0 “off”

Set the (value of the) variable at a-addr to false.

select ( u1 u2 f – u ) gforth-1.0 “select”

If f is false, u is u2, otherwise u1.