SHIP:Sail:Operators

From Serious Documentation
Revision as of 06:28, 13 May 2015 by Admin (talk | contribs) (Created page with "The following standard mathematical operators are available in Sail, listed in precedence order from first to last. Exceptions from C/Java are noted. {| class="wikitable" sty...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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
- Addition, Subtraction
<< >> Bitwise left, right shift


6 < <= For relational operators < and ≤ respectively > >= For relational operators > and ≥ respectively 7 == != For relational = and ≠ respectively 8 & Bitwise AND 9 ^ Bitwise XOR (exclusive or) 10 | Bitwise OR (inclusive or) 11 && Logical AND 12 || Logical OR 13[note 1] ?: Ternary conditional[note 2] Right-to-Left 14 = Simple assignment += −= Assignment by sum and difference

  • = /= %= Assignment by product, quotient, and remainder

<<= >>= Assignment by bitwise left shift and right shift &= ^= |= Assignment by bitwise AND, XOR, and OR 15 , Comma Left-to-right