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


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.