11.3. WMLScript Logical Operators - Performing Boolean Operations

Logical operators are used to perform Boolean operations. The NOT, AND and OR Boolean operations are supported in WMLScript. Logical operators work together with comparison operators, conditional operators, if statements, while statements or for statements for decision-making purposes.

The NOT operator is !. The following WMLScript example illustrates how to use it:


x = !true;
y = !false;

After the execution of the above script, x contains the false value and y contains the true value.


The AND operator is &&. The following WMLScript example illustrates how to use it:


w = true && true;
x = true && false;
y = false && true;
z = false && false;

After the execution of the above script, w contains the true value and x, y and z contain the false value.


The OR operator is ||. The following WMLScript example illustrates how to use it:


w = true || true;
x = true || false;
y = false || true;
z = false || false;

After the execution of the above script, w, x and y contain the true value and z contains the false value.


Previous Page Page 20 of 71 Next Page


A button for going back to the top of this page