Core Features
Operators
Learn about the operators Cambo supports.
Arithmetic Operators
| Operator | Desciption | Example |
|---|---|---|
| + | Adds together two values | a + b |
| - | Substract one value from another | a - b |
| * | Multiplies two values | a * b |
| / | Divide one value by another | a / b |
| % | Returns the division remainder | a % b |
| ++ | Increases the value of a variable by 1 | a++ or ++a |
| -- | Decreases the value of a variable by 1 | a-- or --a |
| ** | One value raised to the power of another | a ** b |
Assignment Operators
| Operator | Desciption | Example | Equivalent To |
|---|---|---|---|
| = | Assign | a = b | a = b |
| += | Add and assign | a += b | a = a + b |
| -= | Substract and assign | a -= 1 | a = a - b |
| *= | Multiply and assign | a *= 1 | a = a * b |
| /= | Divide and assign | a /= 1 | a = a / b |
| %= | Modulus and assign | a %= 1 | a = a % b |
| **= | Power and assign | a **= b | a = a ** b |
| &= | Bitwise AND and assign | a &= b | a = a & b |
| |= | Bitwise OR and assign | a |= b | a = a | b |
| ^= | Bitwise XOR and assign | a ^= b | a = a ^ b |
| >>= | Left shift and assign | a >>= b | a = a >> b |
| <<= | Right shift and assign | a <<= b | a = a << b |
Comparision Operator
| Operator | Name | Example |
|---|---|---|
| == | Equal to | a == b |
| != | Not equal | a != b |
| > | Greater than | a > b |
| < | Less than | a < b |
| >= | Greater than or equal to | a >= b |
| <= | Less than or equal to | a <= b |
Logical Operator
| Operator | Name | Desciption | Example |
|---|---|---|---|
| && | Logical and | Returns true if both statements are true | a < b && c < d |
| || | Logical or | Returns true if one of the statements is true | a < b || c < d |
| ! | Logical not | Reverse the result, returns false if the result is true | !(a < b && c < d) |