Reference
Operators
Equality
| Input | Two arguments of equatable type. |
|---|---|
| Output | True if equal, false otherwise. |
Symbol
==Example
5 == 5 // returns trueInequality
| Input | Two arguments of equatable type. |
|---|---|
| Output | True if not equal, false otherwise. |
Symbol
!=Example
5 != 3 // returns trueGreater than
| Input | Two arguments of the same type. |
|---|---|
| Output | True if first argument exceeds the second, false otherwise. |
Symbol
>Example
5 > 3 // returns trueLess than
| Input | Two arguments of the same type. |
|---|---|
| Output | True if first argument is less than second, false otherwise. |
Symbol
<Example
3 < 5 // returns trueGreater than or equal
| Input | Two arguments of the same type. |
|---|---|
| Output | True if first argument is greater than or equal to second, false otherwise. |
Symbol
>=Example
5 >= 5 // returns trueLess than or equal
| Input | Two arguments of the same type. |
|---|---|
| Output | True if first argument is less than or equal to second, false otherwise. |
Symbol
<=Example
3 <= 5 // returns trueAddition
| Input | Two arguments of addable type. |
|---|---|
| Output | The combined result. |
Symbol
+Example
3 + 4 // returns 7Subtraction
| Input | Two arguments of subtractable type. |
|---|---|
| Output | The result of the subtraction. |
Symbol
-Example
10 - 3 // returns 7Multiplication
| Input | Two numbers. |
|---|---|
| Output | The product of the numbers. |
Symbol
*Example
3 * 4 // returns 12Division
| Input | Two numbers. |
|---|---|
| Output | The quotient. |
Symbol
/Example
10 / 2 // returns 5Modulo
| Input | Two numbers. |
|---|---|
| Output | The remainder of division. |
Symbol
%Example
10 % 3 // returns 1And (short-circuit)
| Input | Two boolean arguments. |
|---|---|
| Output | True only if both arguments are true, false otherwise. Short-circuit (lazy) - the second operand is only evaluated if the first is true. |
Symbol
&& // alias: andExample
true && false // returns falseAnd (strict)
| Input | Two boolean arguments. |
|---|---|
| Output | True only if both arguments are true, false otherwise. Strict (eager) - both operands are always evaluated. |
Symbol
&Example
true & false // returns falseOr (short-circuit)
| Input | Two boolean arguments. |
|---|---|
| Output | True if at least one argument is true, false otherwise. Short-circuit (lazy) - the second operand is only evaluated if the first is false. |
Symbol
|| // alias: orExample
true || false // returns trueOr (strict)
| Input | Two boolean arguments. |
|---|---|
| Output | True if at least one argument is true, false otherwise. Strict (eager) - both operands are always evaluated. |
Symbol
|Example
true | false // returns trueNot
| Input | One boolean argument. |
|---|---|
| Output | True if argument is false; false if argument is true. |
Symbol
! // alias: notExample
!true // returns falseElement at
| Input | An indexable argument (String, List or Map) and a hashable argument. |
|---|---|
| Output | The element at the given position or key. |
Symbol
@ // alias: a[b]Example
[10, 20, 30] @ 1 // returns 20
"abc"[2] // returns "c"
{"name": "Alice"}["name"] // returns "Alice"