Next: , Previous: Comments, Up: Words


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       – f         core-ext       “true”

Constantf is a cell with all bits set.

false       – f         core-ext       “false”

Constantf is a cell with all bits clear.

on       a-addr –         gforth       “on”

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

off       a-addr –         gforth       “off”

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