Unary Arithmetic Operators

M言語プログラミングブック [WALTERS1997] から引用

Page 47

Unary operators are the + and - arithmatic operators if they appear in front of a single operand. Using Unary Operators, strings can be converted to numerical values. The unary “plus” sign does not change the string (It returns the numeric value of the string), the negative unary sign, “minus” changes the sign of the value.

Example:

SET A=0
SET B=1
SET C=-1

WRITE +A returns 0
WRITE -A returns 0
WRITE +B returns 1
WRITE -B returns -1
WRITE +C returns -1
WRITE -C returns 1

Previous topic

Indirection Operator

Next topic

Logical Operators

This Page

inserted by FC2 system