10.1 Comparisons of Integers

n1 = n2
n1 < n2

The equality operator = evaluates to true if the integer n1 is equal to the integer n2 and false otherwise. The inequality operator < evaluates to true if n1 is not equal to n2 and false otherwise.

Integers can also be compared to objects of other types; of course, they are never equal.

    gap> 1 = 1;
    true
    gap> 1 <> 0;
    true
    gap> 1 = (1,2);     # '(1,2)' is a permutation
    false 

n1 < n2
n1 <= n2
n1 n2
n1 = n2

The operators <, <=, , and = evaluate to true if the integer n1 is less than, less than or equal to, greater than, or greater than or equal to the integer n2, respectively.

Integers can also be compared to objects of other types, they are considered smaller than any other object, except rationals, where the Comparisons of Rationals).

    gap> 1 < 2;
    true
    gap> 1 < -1;
    false
    gap> 1 < 3/2;
    true
    gap> 1 < false;
    true 

Up Top Next
Index

GAP 3.4.4
April 1997