Notes: True and False

This note explains the, very simple, concepts of true and false in ICI and the various ways of expressing them.

Sorry George

ICI has no boolean type. Like C it adopts the convention that the relational operators return integers and that control flow constructs use integer expressions as their controls.

Just like C

Like C, ICI's relationals result in either integer 0 or 1 according to the operator and its operands. The set indexing operation also returns these values to indicate set membership.

Unlike C ICI also allows the NULL object to represent false. Remember that NULL is a distinct object type in ICI and not, as in C, the integer 0 cast to a pointer type.

Any non-zero and non-NULL object represents true however the convention is to use the integer one where possible.

The standard include files $PREFIX/lib/ici3/ici3core.ici defines two variables, "true" and "false". True is the integer one and false is zero. These are handy synonyms in code where the user wishes to express their intent of using boolean values. And note that because true and false are simply extern variables it is possible to change their values. This is not recommended.

So there you have it. True and false.