Comparison operation

Description:

Compare two numerical values, sequences, characters or serial bytes.

Syntax:

x==y

If values of two operands are equal, then the result is true. Otherwise, it is false

x! =y

If values of two operands are not equal, then the result is true. Otherwise, it is false

x<y

If x is less than y, then the result is true. Otherwise, it is false

x>y

If x is greater than y, then the result is true. Otherwise, it is false

x<=y

If x is not greater than y, then the result is true. Otherwise, it is false

x>=y

If x is not less than y, then the result is true. Otherwise, it is false

Note:

The comparison operation requires the numeric or character operands, and a Boolean result value. For the Not Less Than (or Not Greater Than) comparison operators, the result value is false only when both the Greater than (or Less than) and Equal to relations are not true, and the result is still true as long as either of the relations is true.

 

If x and y are sequences, then x and y will be compared in one-to-one relationship in the sequential order of members. Return the result according to the relationship of first pair of unequal members undergoing the alignment comparison. Return true if the conditions are met; Otherwise, return false. However, for the comparison operator == used for alignment comparison, the true will only be returned when all members are equal. Otherwise, return false. If the numbers of members in sequences x and y are not the same, and those compared members are the same, then the one with fewer members is smaller.

 

If x and y are serial bytes, the comparison starts from the first byte and stops if the the first pair of different bytes appears. Return true if the conditions are met; Otherwise, return false. Relational operators include >, >=, <, <=. x and y need to have the same number of bytes; otherwise, they are incomparable.

Parameter:

x

Sequence, numerical, character data or serial bytes

y

Sequence, numerical, character data or serial bytes

Return value:

Boolean

Example:

 

A

 

1

=2==3

false

2

=2!=5

true

3

=2>5

false

4

=10<5

false

5

=2<=3

true

6

=3>=4

false

7

="a"=="b"

false

8

=[5,2,1,2]<=[5,2,1,2,-3]

true

9

=k(1)==k(1:2)

false

10

=k(3)!=k(1:2)

true

11

=k(1:2)<k(3:2)

true

12

=k(1:2)>k(3:2)

false

13

=k(2:2)<=k(1:2)

false

14

=k(2:2)>=k(1:2)

true