WMLScript » Operators » Comparison

Syntax:
== > >= < <= !=

The comparison operators are used to determine the relationship, in terms of equality or rank, between the values of two operands. A true, false, or invalid is returned, depending on the results of the comparison. A true signifies that the comparison was successful. A false signifies that the comparison failed. An invalid signifies that at least one of the operands is of invalid type.

These operators are commonly used in test conditions in if and while statements.

This operator uses the following format:

operand1 operator operand2

There are certain rules that are obeyed when making a comparison:

  • true is greater in value than false.
  • The value of a character is determined by the order of the character codes in the character set being used by the browser.
  • If either or both operands are invalid, then the comparison is invalid.
There are six comparison operators.

!=

Syntax: !=

>

Syntax: >

>=

Syntax: >=

<

Syntax: <

<=

Syntax: <=

==

Syntax: ==

See Also: