Operators
Addition
Adds two numbers, usually in connection with variables:
quantity + 5
price1 + price2
But it can also concatenate two strings:
"Hello " + name
Subtraction
Subtracts two numbers, usually in connection with variables:
quantity - 6
total - discount
Multiplication
Multiplicates two numbers, usually in connection with variables:
quantity * 3
quantity * price
Division
Divides one number by another, but not by zero. Usually in connection with variables:
percentage / 100
Modulo
Calculates remainder of division:
index % 2
Greater Than
Compares two numbers and returns true if the first one is greater than the second one:
price > 50
Greater Than or Equal To
Compares two numbers and returns true if the first one is greater than or equal to the second one:
price >= 50
Lower Than
Compares two numbers and returns true if the first one is lower than the second one:
price < 50
Lower Than or Equal To
Compares two numbers and returns true if the first one is lower than or equal the second one:
price <= 50
Assignment
Assigns evaluated expression to a variable. If variable does not exist in context of data structure then it is created and the variable can be used later in template:
line_total = quantity * price
Equal
Compares two numbers and returns true if the first one is equal to second one:
price == 50
Not Equal
Compares two numbers and returns true if the first one is not equal to second one:
price != 50
price <> 50
Was this article helpful?
Yes
No