Operator Precedence

Contrary to other languages, MUMPS reads a mathematical sequence from left to right and disregards order of operations.

For example:

SET x=2+6/2

WRITE x

x=4 (not 5)

This may take a little getting used to for some; however, parentheses take precedence in a sequence. You can use them to override the left to right precedence.

To use the previous example:

SET x=2+(6/2)

WRITE x

x=5

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

Page 45

Previous topic

String Operators

Next topic

配列(Arrays)

This Page

inserted by FC2 system