An operator, in a programming language, is a symbol that represents an action. It tells the program to perform specific mathematical, relational, logical or assignment actions on given values to produce a final result. The values on which the action is performed are known as the operands. The operands can be Zoho Creator fields, variables declared in Deluge or expressions.
(7 * 7) + 4 = 53
"Hello" + "world" = "Hello world" // concatenates string values
The different types of operators are:
An arithmetic operator, operates on one or two numeric value and returns a numeric value.
<op1> <Operator> <op2>
where, <op1> and <op2> are both numeric expressions. The table below lists the binary arithmetic operators and their functionality:
|+||x + y||Addition operator: Adds the value of x to the value of y.
|-||x - y|
Subtraction operator: Subtracts the value of y from the value of x.
|*||x * y||multiplies <op1> and <op2>|
|/||x / y||divides <op1> by <op2>|
|%||x % y||remainder when dividing <op1> by <op2>|
A relational operator compares two values and returns a boolean expression (true or false) depending on the relation between the two values.
5 > 4 -> true
233.6 < 94.22 -> false
<op1> <Operator> <op2>
The table below lists the binary arithmetic operators and their functionality:
|>||<op1> is greater than <op2>|
|>=||<op1> is greater than or equal to <op2>|
|<||<op1> is less than <op2>|
|<=||<op1> is less than or equal to <op2>|
|==||<op1> is equal to <op2>|
|!=||<op1> is not equal to <op2>|
Relational operator combined with conditional operators, make your decision making more powerful. A conditional operator operates on boolean expression and each boolean expression may contain relational operator or conditional operator, thus enabling us to write complex decision logics. Deluge supports the conditional operators '&&' , '||' and '!'.
<boolean expression> && <boolean expression>
<boolean expression> || <boolean expression>
! <boolean expression>
'&&' - returns true only if both the left and right boolean expressions are true.
'||' - returns true if atleast one of the boolean expression evaluates to true.
'!' - returns true if the boolean expression is false and vice-versa.
|&&||Both the left and right boolean expressions are true|
|ll||Atleast one of the boolean expression is true|
|!||boolean expression is false|
To assign values to the left operand, with or without performing arithmetic operations, based on the value of the right operand
x += 1
// x = x + 1 = 3
The table below lists the binary assignment operators and their functionality:
|=||x = 2 // assigns the value 2 to x.|
|+=||x += 1 // x = x + 1 = 3|
|-=||x -= 1 // x = x - 1 = 2|
|*=||x *= 1 // x = x * 1 = 2|
|/=||x /= 1 // x = x / 1 = 2|
|%=||x %= 1 // x = x % 1 = 0|