Contents | Prev | Next

8.2.4.3 Is less than or equal

Description

When the <= operator has two numeric operands then it compares their values. If one operand is of integral type and the other is of real type then the integral operand is converted to real before the comparison is made. The result of this operation is of boolean type and is true if the left operand is less than or equal to the right operand, and false otherwise.

When the <= operator has two numeric operands of string type then it compares the lexical ordering of the operands.

When the <= operator has two operands of set type then it tests for set inclusion. The result of this operation is true if all the members of the left operand are in the right operand, and false otherwise.

Example

For example:

   23 <=   23    results in true
  -23 <=  -23    results in true
   23 <= 23.0    results in true
 23.0 <=   23    results in true
    2 <=    3    results in true
    2 <=   -3    results in false
   -2 <=   -3    results in false
    3 <=    2    results in false
   -3 <=    2    results in true
   -3 <=   -2    results in true

and

  'abc' <= 'abc'  results in true
  'abc' <= 'abc' results in true
  'abc' <= 'ab'  results in false
  'abc' <= 'abd'  results in true
  'abc' <= 'aac'  results in false
  'abc' <= 'b'    results in true

and

   ['a', 'b', 'c'] <= ['a']            returns false
   ['a', 'b', 'c'] <= ['a', 'b']       returns false
   ['a', 'b', 'c'] <= ['a', 'b', 'c']  returns true
   ['a']           <= ['a', 'b', 'c']  returns true
   ['a', 'b']      <= ['a', 'b', 'c']  returns true
   []              <= ['a']            return true
   ['a']           <= []               return false

Contents | Prev | Next