For an overview on conditionals in WayScript, refer to the Introduction to Conditionals.
You will use this block to define a logic expression.
To create a logic expression, you will typically define values for the two Variable fields and then select how you want to compare them using the Comparison field.
Some comparisons, such as "Has Increased," "Has Decreased," "Has a Value," or "Does Not Have a Value," do not require a second variable input.
After defining a value for the first Variable, you can select an option for the Comparison field.
You will not be able to select a value for the Comparison field until a value for the first Variable has been defined.
Is The Same As
Is Not The Same As
Is Greater Than
Is Greater Than or Equal To
Is Less Than
Is Less Than or Equal To
Has Changed By
Has Not Changed By
Has Increased By
Has Decreased By
Has a Value
Does Not Have a Value
Is The Same As
Is Not The Same As
Contains
Is Contained In
Is Not Contained In
Shares any Items With
Has Any Items
Has Changed
Has Not Changed
Has a Value
Does Not Have a Value
Is The Same As
Is Before
Is After
Has Changed By
Has Not Changed By
Has a Value
Does Not Have a Value
For non-Number fields, you will have the option to compare in a Case Sensitive manner. (Default comparison is Case Insensitive.)
For "Changed By," "Increased/Decreased By," and similar comparisons, you can optionally choose the amount by which you want to check the value has changed. You can also choose whether to compare to the Original Value of the variable, or the Last (most recent) Value.
To see the "Since" field, click the "Show Advanced Settings" checkbox.
By pressing the + Add Condition button, you can add additional conditions.
And: Use if you want your expression to evaluate to True
only when both conditions are True
.
Or: Use if you want your expression to evaluate to True
when at least one of your conditions are True
.
The If branch will run if your logic expression evaluates to True
.
The Else-If branch will run if the proceeding logic expression evaluates to False
, but the logic expression in the current Else-If branch evaluates to True
.
The Else branch will run if all of the proceeding logic expressions evaluate to False
.
In the image above, if Temperature is greater than or equal to 90, the first branch will run. Otherwise, if the temperature is less than or equal to 65, the second branch will run. Finally, if the temperature is less than 90, but greater than 65, the else branch will run.
Click the + Add "Else If" button to add more Else-If conditions.
In the below example, if the value of the variable "Temperature" is between 65 and 90, then the program will print "It's a nice day!".
Else, if the "Temperature" variable is outside of this range, then the program will print "It's too cold!".
The program will then continue to run the rest of the modules following the If / Else statement.