Overview
Operators are symbols used in App Scripts to perform actions like comparing values, combining conditions, or doing math. Understanding these is key to writing logical and efficient scripts.
🧠1. Logical Operators
Use these operators when performing logic (e.g. conditional statements such as if()
) in App Scripts.
Operator | Description | Example |
&& |
AND |
if(currentValues["Priority"] && currentValues["Status"]){ |
|| |
OR |
if(currentValues["Priority"] == "Low" || currentValues["Priority"] == "Medium"){ |
! |
NOT |
if(currentValues["Status"] && !currentValues["Priority"]){ |
👉|👈Relational Operators
Use these operators to compare values of two objects against each other, or set the value of one object to the value of another object.
Operator | Description | Example |
== |
Test equality between two objects (e.g. is the Status field equal to "Open") |
if(currentValues["Priority"] == "High"){ |
!= |
Test difference between two objects (e.g. is the Priority field NOT equal to "High") |
if(currentValues["Priority"] != "High"){ |
< |
Less than |
if(currentValues["Units in Order"] < 25){ |
<= |
Less than or equal to |
if(currentValues["Units in Order"] <= 25){ |
> |
Greater than |
if(currentValues["Units in Order"] > 100){ |
>= |
Greater than or equal to |
if(currentValues["Units in Order"] >= 100){ |
= |
Set the value on the left of the equals sign (=) to whatever the value is on the right of the equals sign |
currentValues["Status"] = "Yes"
|
âž• Arithmetic Operators
Use these operators to perform basic math.
Operator | Description | Example |
+
|
Addition (also used for concatenation of fields) |
int ten = 10 as int |
-
|
Subtraction |
int ten = 10 as int |
*
|
Multiplication |
int ten = 10 as int |
/
|
Division |
int ten = 10 as int |
++
|
Increment by 1 |
//Objective: When "Add Tasks" is "Yes" and Number of Tasks has a value, |
--
|
Decrement by 1 |
//Objective Use a Loop with a Counter that decrements by 1 after each loop)
|
Related Articles:
Comments
0 comments
Please sign in to leave a comment.