Logic constants

The logic constants are the integer constants TRUE and FALSE. While the constant TRUE has the value 1, in general any integer value different to 0 will serve as a truth value of true (see Boolean).

Name Value
FALSE 0
TRUE 1

TRUE and FALSE are special in that, unlike all other constants, neither of them can be prefixed by a minus sign in either the globals section or after a typecast, for example:

integer a = -TRUE; // Syntax error
integer b = -LINK_ROOT; // Valid

default
{
    state_entry()
    {
        integer c = (integer)-FALSE; // Syntax error
        integer d = (integer)-LINK_ROOT; // Valid
    }
}

See also