# Operators

## Overview

Operators are a form of functions which acts on one or two values and return a value. Very commonly used functions are given operator status and are invoked by special symbols such as '+' for addition, '-' for subtraction etc.

Example:

(7 * 7) + 4 = 53
Hello " + "world" = "Hello world"

## Types of Operators

#### Arithmetic Operators

An arithmetic operator, operates on one or two numeric value and returns a numeric value.

Binary Arithmetic Operators

It operates on two values and hence called binary arithmetic operators.

Syntax

<op1> <Operator> <op2>

where, <op1> and <op2> are both numeric expressions. The table below lists the binary arithmetic operators and their functionality:

 Operator Functionality + addition of and - subtracts from * multiplies and / divides by % remainder when dividing by

Unary Arithmetic Operators

It operates on single value.

Syntax

<operator> <op1>

where, <op1> is a numeric expression. The table below lists the unary arithmetic operators and their functionality:

 Operator Functionality + functionality wise, it has no effect - negates the given value

#### Relational Operators

A relational operator compares two values and returns a boolean expression (true or false) depending on the relation between the two values.

Example

5 > 4 -> true
233.6 < 94.22 -> false

Syntax

<op1> <Operator> <op2>

The table below lists the binary arithmetic operators and their functionality:

 Operator Functionality > is greater than >= is greater than or equal to < is less than <= is less than or equal to == is equal to != is not equal to

#### Conditional Operators

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 '!'.

Syntax

<boolean expression> && <boolean expression>
<boolean expression> || <boolean expression>
! <boolean expression>

where,

'&&' - 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.

 Operator Functionality && Both the left and right boolean expressions are true ll Atleast one of the boolean expression is true ! boolean expression is false

#### List Operators - in, not in

The "in" and "not in" list operators define a criteria in 'for each' or 'fetch' tasks.

1. The List Operator in checks whether a value is within a set of values

Syntax

<expression1> in <expression2>

where, the right expression should be of type "List"

2. The List Operator not in checks whether a value is not within a set of values

Syntax

<expression1> not in <expression2>

where, the right expression should be of type "List"

Example

If you wish to fetch some records based on field value being part of a list (say Client is a field and values required are "Jasper", "Edward" or "Alice"), then you may add those values in a list (say clientList) and then utilize this list in your criteria to fetch the required records.If you wish to exclude some values from fetching, use "not in" in your criteria. This is a simplified model of [Client =="Jasper" ||Client =="Edward" ||Client =="Alice"]

1. clientList = {"Jasper", "Edward", "Alice"};
2. <variable> = form_name[Client in clientList];