The operators in the Sporkl language are similar to those found in other programming languages. One notable difference is that the increment and decrement operators (both prefix and postfix) do not return values.
Below is the list of Sporkl operators, in order of increasing precedence:
| Operator | Description |
|---|---|
| a, b | List separator |
|
a = b a += b a -= b a *= b a /= b a %= b a |= b a &= b a ^= b |
Assign Add assign Subtract assign Multiply assign Divide assign Modulo assign Bitwise-OR assign Bitwise-AND assign Bitwise-XOR assign |
| a ? b : c | Inline conditional |
| a || b | Logical OR |
| a && b | Logical AND |
| a | b | Bitwise-OR |
| a ^ b | Bitwise-XOR |
| a & b | Bitwise-AND |
| a == b a != b |
Is equal to Is not equal to |
| a < b a <= b a > b a >= b |
Is less than Is less than or equal to Is greater than Is greater than or equal to |
| a << b a >> b |
Left bit-shift Right bit-shift |
| a + b a - b |
Add, Concatenate (strings) Subtract |
| a * b a / b a % b |
Multiply Divide Modulo |
| ~a !a -a ++a --a |
Bitwise-inversion Logical negation Negative Increment (prefix) Decrement (prefix) |
| a++ a-- |
Increment (postfix) Decrement (postfix) |
| a[b] | Array index |
| (a) | Association |