WMLScript
Operators
WMLScript
provides a large number of operators that help us do many different
kinds of things. For example, we use the + operator to add two
numbers together. In the following sections, we will introduce to you
some of the more commonly used operators. Many of them are used in
the same way as in C++, Java, JavaScript, etc. You may skip some
parts if you are familiar to them.
WMLScript
Arithmetic Operators  Performing Math Operations
WMLScript
arithmetic operators can help you perform various kinds of math
operations.
Basic Math
Operations  Addition, Subtraction, Multiplication, Division, Finding
Remainders
Basic
math operations like addition, subtraction and multiplication are
done using the +,  and * operators. For example:
z
= 1 + 2;
z
has the value 3.
z
= 5  3;
z
has the value 2.
z
= 2 * 3;
z
has the value 6.
Two
operators, / and div, can be used to perform division. The result
returned by the / operator is of the float type and that returned by
the div operator is of the integer type. Here is a WMLScript example
that illustrates the difference between them:
x
= 3 / 2; y = 3 div 2;
After
execution, x has the floatingpoint value 1.5 while y has the
integral value 1.
To
find the remainder of division, use the % operator. For example:
x
= 3 % 2; y = 20 % 2; z = 20 % 3;
After
execution, x has the value 1, y has the value 0 and z has the value
2.
Feedback Form (ExpandCollapse)

