# IF

The IF component allows to conditionally execute other components based on a condition.

# Conditions

The component accepts a boolean expression as input and if the expression is true, it will execute the components that are between the IF and the ENDIF components.

You can find some string manipulation examples here: JavaScript String Methods.

# Condition examples

barcode.endsWith("US")
number == 1
timestamp > new Date().getTime() * 1000
device_name == "John's iPhone"

# Full Example

Let's say that you want to ask for a quantity value only if the barcode conains exactly 0001.

What you can do is surround the NUMBER component with an IF and an ENDIF component:

and then use the following expression for the IF component:

barcode == '0001'