SHIP:Sail:Operators

From Serious Documentation
Revision as of 06:45, 13 May 2015 by Admin (talk | contribs)
Jump to: navigation, search

The following standard mathematical operators are available in Sail, listed in precedence order from first to last. Exceptions from C/Java are noted.

SHIPSail Operators and Precedence
Group Operator(s) Description Order
1 . Identifier qualification Left-to-right
2 ++ --

()

Post-increment/decrement

Function call

3 ++ --

+ - ! ~

Pre-increment/decrement

Logical/Bitwise NOT

Right-to-left
4 * / % Multiplication, Division, Modulus Left-to-Right
5 + - Addition, Subtraction
6 << >> Bitwise left, right shift
7 < <= > >= Less than, Less than or equal

Greater than, greater than or equal

8 == != Equal, not equal
9 & Bitwise AND
10 ^ Bitwise XOR
11 | Bitwise OR
12 && Logical AND
13 || Logical OR
14 :? Ternary Conditional Right-to-Left; Expression between ? and ? always parsed as if parenthesized.
15 = += -= *= /= %= <<= >>= &= ^= |= Assignment

Add- and Subtract-assign Multiply-, Divide-, and Modulus-assign Bitwise left, right shift-assign Bitwise AND, XOR, OR assign

Right-to-Left