CM operators have priorities that determine how their arguments are bound. Operators with higher priority take precedence over operators with lower priority. For instance, the value of the expression **1 + 2 * 3** is 7 and not 9, since the multiplication operator has higher priority than the addition operator.

The following table lists all CM operators and their priorities. Some of the rows contain expressions which are not built-in operators but syntax extensions.

Operator | Name | Priority | Example |
---|---|---|---|

# | string append | 105 | a # b |

?: | conditional operator | a ? b : c | |

or | logical OR | 30 | a or b |

xor | logical XOR | 30 | a xor b |

and | logical AND | 40 | a and b |

== | equal | 42 | a == b |

!= | not equal | 42 | a <= b |

< | less than | 45 | a < b |

> | more than | 45 | a > b |

<= | less than or equal | 45 | a <= b |

>= | more than or equal | 45 | a >= b |

bitor | bitwise OR | 50 | a bitor c |

bitxor | bitwise XOR | 50 | a bitxor c |

bitand | bitwise AND | 70 | a bitand b |

in | member | 75 | a in b |

!in | not member | 75 | a !in b |

>> | arithmetic shift right | 100 | a >> b |

>>> | logical shift right | 100 | a >>> b |

<< | aritmethic shift left | 100 | a << b |

.. | range | 108 | a..b |

+ | addition | 110 | a + b |

- | subtraction | 110 | a - b |

* | multiplication | 120 | a * b |

/ | division | 120 | a / b |

% | remainder | 120 | a % b |

** | power | 130 | a ** b |

| | | absolute value | |a| | |

.: | type conversion | a.:type | |

~ | bitwise NOT | 510 | ~a |

! | logical NOT | 510 | !a |

++ | postincrement | 530 | a++ |

++ | preincrement | 530 | ++a |

-- | postdecrement | 530 | a-- |

-- | preincrement | 530 | --a |

- | arithmetic negation | 540 | -a |

[ ] | indexed access | 570 | a[b] |

## Comments

0 comments

Please sign in to leave a comment.