docs
Language Structure
Operators

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 + 5

operator + was used to add 1 to 5

OperatorDescription
+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 " + 25 works. Other arithmetic operators (-, *, /, %, ^) require numbers; mismatched types raise a Kin error instead of returning ubusa.

^ is right-associative and binds tighter than * / / (2 ^ 3 ^ 2 is 512, 2 * 3 ^ 2 is 18). 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.

OperatorDescription
==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.

OperatorDescription
&&and
||or
!not