Intro
Kin comes with set of many operators which performs various operations.
In this notebook, we will explain usage of Kin operators to perform various operations.
Arthimetic Operators
Arithmetic Operators are used to perform arithmetic on numbers:
Ex:
x = 1 + 5operator + was used to add 1 to 5
| Operator | Description |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| ^ | Exponentiation |
| % | Modulus (Division Remainder) |
Note:
+on two strings concatenates them. A string and a number also concatenate (the number is coerced), so"Ufite imyaka " + 25works. Other arithmetic operators (-,*,/,%,^) require numbers; mismatched types raise a Kin error instead of returningubusa.
^is right-associative and binds tighter than*//(2 ^ 3 ^ 2is512,2 * 3 ^ 2is18). Unary minus works on numbers and variables (-x).
Assignment Operator
Assignment operator is used to assign values to variables.
Kin uses = as assignment operator.
Comparison Operators
Comparison operators are used to compare multiple expressions.
| Operator | Description |
|---|---|
| == | equal to |
| != | not equal |
| != | not equal value |
| > | greater than |
| < | less than |
| >= | greater than or equal to |
| <= | less than or equal to |
Logical Operators
Logical operators are used to combine conditional statements.
| Operator | Description |
|---|---|
| && | and |
| || | or |
| ! | not |