Cold Help System: Programming: ColdC Reference Manual: Language Structure: Expressions: Operators: Logical Operators

ColdC provides a number of relational and logical operators. These operators are primarily useful for expressing conditions, since they return either true or false, represented by the integers 1 and 0.

The binary operators == and != test the left and right arguments for equality and inequality, respectively. The arguments are equal if each side has the same data type and contains the same value. Equality of strings is not case-sensitive, but equality of symbols is, so ("foo" == "fOo") is true, but ('car == 'CAr) is false. Lists are equal if all of the elements in each list are equal and are in the same order.

The <, <=, >=, and > operators test whether their left-hand arguments are less than, less than or equal to, greater than or equal to, or greater than their right-hand arguments, respectively. Arguments to these operators must both be of the same type, and must be either numeric or a string. String comparison is not case-sensitive, so ("fooa" < "fooB") is true, even though the ASCII value of `a' is greater than that of `B' (the function strcmp() may be used for a true lexical case-sensitive comparison of strings).

The unary ! operator tests whether its argument is false, thus acting as a logical NOT operation.

Operator Precedence | Index Operators | Arithmetic Operators | Assignments | Logical Operators | Conditional | List Splice Operator

the Cold Dark