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
parts if you are familiar to them.
Arithmetic Operators - Performing Math Operations
arithmetic operators can help you perform various kinds of math
11.1.1. Basic Math
Operations - Addition, Subtraction, Multiplication, Division, Finding
math operations like addition, subtraction and multiplication are
done using the +, - and * operators. For example:
= 1 + 2;
has the value 3.
= 5 - 3;
has the value 2.
= 2 * 3;
has the value 6.
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:
= 3 / 2;
y = 3 div 2;
execution, x has the floating-point value 1.5 while y has the
integral value 1.
find the remainder of division, use the % operator. For example:
= 3 % 2;
y = 20 % 2;
z = 20 % 3;
execution, x has the value 1, y has the value 0 and z has the value
Feedback Form (ExpandCollapse)