BOOLEAN VALUES

From TinyMUX
Jump to navigation Jump to search

BOOLEAN VALUES

There are three types of Boolean Values in MUX: BITS, BOOLEAN, and BOOLEAN-Z. In each case, a Boolean Value is either TRUE or FALSE, and all possible strings are mapped onto one of those two.

  1. The most comprehensive definition of Boolean Value is denoted simply as BOOLEAN. Newer functions and features use the BOOLEAN definition of a Boolean Value. MUX maps the following to FALSE:
    • Numbers (integer and floating-point) with a value of zero.
    • The Special floating-point values of NaN, Ind, +Inf, and -Inf.
    • Strings with zero-length.
    • Any error message of the form "#-N <msg>".

All other strings are understood as TRUE including negative numbers and dbrefs.

  1. BITS is another form of a Boolean value. An integer can be broken down into BITS. Taken together, the server shows them as an integer, but there are functions which indirectly manipulate individual BITS.
  1. BOOLEAN-Z defines FALSE as an integer zero. This definition still appears in MUX for softcode compatibility.

Alphabetic strings are FALSE. Everything after the decimal point in a floating-point number is ignored. Dbrefs are not recognized but mapped to FALSE. TRUE is then any non-zero number.

NOTE: T() allows a BOOLEAN value to be used with a BOOLEAN-Z function, and Boolean Values from functions can be interpreted correctly by either BOOLEAN or BOOLEAN-Z definitions.

Examples:

not(foo) --> 0 not() --> 1 not(-66) --> 0
not(0) --> 1 not(#-1) --> 1 not(#12) --> 0
t(1) --> 1 t(#-1) --> 0 t(-66) --> 1

Related Topics: not(), t()