
14–10 RSView32 User’s Guide
Arithmetic operators
Arithmetic operators calculate values based on two or more numeric
values. The arithmetic operators are:
String operands
The + operator can be used to join string operands. For example, the
expression “hello” + “world” returns: helloworld.
Symbol Operator Example
(For these examples, tag1 = 5 and tag2 = 7)
+ addition tag1 + tag2
returns a value of 12
- subtraction tag1 - tag2
returns a value of –2
* multiplication tag1 * tag2
returns a value of 35
/ division tag1 / tag2
returns a value of 0.7142857
MOD, % modulus (remainder) tag2 MOD tag1
returns a value of 2
The modulus operator is the remainder of one number
divided by another. For example, the remainder of 13
divided by 5 is 3; so 13 % 5 = 3.
Important: This operator is for integers only, not floating
point numbers.
** exponent tag1 ** tag2
returns a value of 78125
Be sure that any tag value you use as a divisor cannot at some point
have a value of zero. Expressions that attempt to divide a number by
zero produce an error at runtime.
Komentarze do niniejszej Instrukcji