The plus operator is used to add two numbers together. Examples:
1 + 1
This will return 2.
1 + 2 + 3
This will return 6.
The minus operator is used to subtract two numbers. Examples:
1 - 1
This will return 0.
1 - 2 - 3
This will return -4.
The multiply operator is used to multiply two numbers. Examples:
1 * 1
This will return 1.
1 * 2 * 3
This will return 6.
The divide operator is used to divide two numbers. Examples:
1 / 1
This will return 1.
100 / 10 / 2
This will return 5.
The power operator is used to raise a number to a power. Examples:
2 ^^ 2
This will return 4.
2 ^^ 3
This will return 8.
Multiple different arithmetic operators can be chained together. Examples:
1 + 1 * 2 ^^ 2
This will return 5.
1 + 1 * 2 ^^ 2 / 2
This will return 3.
The left shift operator is used to shift a number to the left. Examples:
1 << 1
This will return 2.
1 << 2
This will return 4.
The right shift operator is used to shift a number to the right. Examples:
1 >> 1
This will return 0.
1 >> 2
This will return 0.
The equals operator is used to check if two values are equal. Examples:
1 == 1
This will return true.
1 == 2
This will return false. Note: The equals operator can only be used to compare two values of the same type.
The not equals operator is used to check if two values are not equal. Examples:
1 != 1
This will return false.
1 != 2
This will return true. Note: The not equals operator can only be used to compare two values of the same type.
The greater than operator is used to check if a value is greater than another value. Examples:
1 > 1
This will return false.
1 > 2
This will return false.
2 > 1
This will return true.
The less than operator is used to check if a value is less than another value. Examples:
1 < 1
This will return false.
1 < 2
This will return true.
2 < 1
This will return false.
The greater than or equal to operator is used to check if a value is greater than or equal to another value. Examples:
1 >= 1
This will return true.
1 >= 2
This will return false.
2 >= 1
This will return true.
The less than or equal to operator is used to check if a value is less than or equal to another value. Examples:
1 <= 1
This will return true.
1 <= 2
This will return true.
2 <= 1
This will return false.
The and operator is used to check if two values are true. Examples:
true and true
This will return true.
true and false
This will return false.
false and true
This will return false.
false and false
This will return false.
The or operator is used to check if one of two values is true. Examples:
true or true
This will return true.
true or false
The not operator is used to check if a value is false. Examples:
not true
This will return false.
not false
The xor operator is used to check if one of two values is true, but not both. Examples:
true xor true
This will return false.
true xor false
The bitwise and operator performs a bitwise and operation on two numbers. Examples:
1 & 1
This will return 1.
1 & 2
This will return 0.
The bitwise or operator performs a bitwise or operation on two numbers. Examples:
1 | 1
This will return 1.
1 | 2
This will return 3.
The bitwise xor operator performs a bitwise xor operation on two numbers. Examples:
1 ^ 1
This will return 0.
1 ^ 2
This will return 3.
The type of operator is used to get the type of a value. Examples:
typeof 1
This will return Int
.
typeof "Hello, world!"
This will return String
.
The is operator is used to check if a value is of a certain type. Examples:
1 is Int
This will return true.
1 is String
This will return false.
The equals operator is used to assign a value to a variable. Examples:
a = 1
This will assign 1 to the variable a.
a = 1 + 1
This will assign 2 to the variable a.
A variable can be read by using its name. Examples:
a = 1
a
This will return 1.
a = 1 + 1
a
This will return 2.
A 32-bit signed integer. Range: 2^32 -1 to -2^32
A 8-bit boolean value. Range: true or false