Relational Operators

 

Operator  Purpose
==equal
!=different
<less than
<=less than or equal
>greater than
>=greater than or equal

 

This are pretty much self explanatory, they are used to compare 2 values.

I just want to point out that the equality between 2 values is checked via == not =.

As we learned = is an assignment operator, which puts a value into a variable, does not check if the value of the variable is the same as another value.

 

EXAMPLE

def a = 1 (variable a now holds value 1)

def b = 1 (variable b now hold value 1)

 

This is how we check if variable a is equal with variable b

a == b

 


Logical operators

 

Operator  Purpose
&&AND
||OR

!
NOT

 

This are the most important logical operators in the context of Sales Cloud.

If you want a complete list of all the Logical Operators please check this Link.

But it is doubtful you will actually use any other logical operators while scripting in Application Composer.

 


&& (AND)

– when we use this operator we want that all the conditions to met at the same time, before an action is done.

 

So if we say

def a = 1

def b = 2

def c = 1

 

a == c && a < b  both of this conditions have to met at the same time before code continues to execute

 


||  (OR)

– when we use this operator we want that at least one of the conditions to be met before we continue

 

So like before 

def a = 1

def b = 2

def c = 1

 

a == c || a == b   is enough that one of the two conditions to be true and then code continues to execute, a == c is true, so our code will continue execution




! (NOT)



This operator basically gives the revers of a Boolean

So if we say !true that means false and if we do !false that means true

Leave a Reply

Your email address will not be published. Required fields are marked *