Arithmetic operators are grouped left to right. When a statement contains more than one operator, the operations are performed in their order of precedence. See “Operator order of precedence” for information about the precedence of the arithmetic operators.
Use parenthesis ( ) to perform operations in non-precedence
order. For example, for d = a + b * c
,
the variable “d” contains
the result of “b” multiplied
by “c”, then added to “a”,
while for d = (a + b) * c
,
the variable “d” contains
the result of a plus “b” multiplied
by “c”. In the examples shown in Table 1-3, “a”, “b”,
and “c” are integer data.
Always put a space character between the addition or
subtraction operators and the data, so that the data parser does
not mistake them for sign characters rather than arithmetic operators.
For example:
c = 20 - 10
;
not: c = 20-10
.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |