If/Else

We can also use If/Else logic to only do something with our script if it does or doesn't meet a certain condition. In this example, we will use price. If the price is below $500 we will write to a new column that it is a low price. Or else, if the price is above $500 we will write that it is a high price.

Our code will look like this:

alt text

Using our conditional if/else logic you can see the messages that were written on the exported spreadsheet.

alt text

In this example we used the condition to determine what we wrote to the spreadsheet but you can also use if/else statements when you only want to execute a certain block of code if a condition is met or not met.


Previous section:
Next section: