Logic Operators: AND (&&) and OR (||)

  • Updated

AND or OR statements allow us to evaluate multiple logic statements at one time.

OR Statement

For an OR statement, we use the double pipe syntax: ||

This operator is used if any one of the statements must be true. Each statement must be contained within round brackets ().

 

OR

Input

{#(entity_jurisdiction=='Alberta') || (entity_jurisdiction=='Ontario')}True{/}

Meaning

IF the jurisdiction is Alberta OR Ontario, then print ‘True'.

Sample Data #1

Jurisdiction: Alberta

Output #1

True

Sample Data #2

Jurisdiction: Quebec

Output #2

[no output]

 

AND Statement

For an AND statement, we use the double ampersand syntax: &&

This operator is used if multiple statements must be true at the same time. Each statement must be contained within round brackets ().

 

 

AND

Input

{#(entity_jurisdiction!='British Columbia') && (entity_jurisdiction!='Nova Scotia')}Corporation{/}

Meaning

IF the jurisdiction is NOT British Columbia AND NOT Nova Scotia, then print ‘Corporation'.

Sample Data #1

Jurisdiction: Alberta

Output #1

Corporation

Sample Data #2

Jurisdiction: British Columbia

Output #2

[no output]

Sample Data #3

Jurisdiction: Nova Scotia

Output #3

[no output]