Previous

Next

 

Conditions

 

A condition is a comparison. This phrase encompasses the essence of what is a condition. A simple condition is made of three elements:

  1. the first value,
  2. a comparison operator, and
  3. the second value.

Values may be of any type (numericals, character strings or containers) and may be expressed explicitly as constants or implicitly as expressions to be evaluated. In order for a comparison to make sense, compared values must be of the same type or of comparable types.

The comparison operator in a simple condition is called a relational operator. These operators are used to compare the magnitude of two values.

A simple condition can also be a type validation, which are tests used to verify the type of a value. The tested value may it be a constant or obtained from an expression.

Furthermore, simple conditions may be grouped together into a compound condition using logical operators.