11.4. WMLScript
Comparison Operators  Checking Two Values against a Certain
Condition
A
comparison operator takes two operands, checks their values against a
certain condition and returns true or false depending on whether the
condition is satisfied. Six comparison operators are available in
WMLScript:
== Checks
whether two values are equal.
!= Checks
whether two values are not equal.
< Checks
whether a value is less than another value.
<= Checks
whether a value is less than or equal to another value.
> Checks
whether a value is greater than another value.
>= Checks
whether a value is greater than or equal to another value.
The
following WMLScript examples demonstrate how to use the comparison
operators:
The
== Operator:
x
= (99==99); y = ("WMLScript Tutorial"=="WMLScript
Tutorial"); z = ("wmlscript tutorial"=="WMLScript
Tutorial");
After
executing the script, x and y contain the true value and z contains
the false value since string comparisons are casesensitive in
WMLScript.
The
!= Operator:
x
= (99!=100); y = (99!=99);
After
executing the script, x and y contain the true and false value
respectively.
The
< and <= Operators:
x
= (90<99); y = (90<=99);
After
executing the script, both x and y contain the true value.
x
= (100<99); y = (100<=99);
After
executing the script, both x and y contain the false value.
x
= (99<99); y = (99<=99);
After
executing the script, x has the value false while y has the value
true.
The
> and >= Operators:
x
= (90>99); y = (90>=99);
After
executing the above script, both x and y have the false value.
x
= (100>99); y = (100>=99);
After
executing the above script, both x and y have the true value.
x
= (99>99); y = (99>=99);
After
executing the above script, x contains the value false while y
contains the value true.
Feedback Form ( ExpandCollapse)
