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 compare two variables or values. This is done by using python syntax:

Default is True, leaving True will result in the statement always evaluating to True so the if side of the conditional above will execute. False is also a valid input which results in the else side executing.

The conditionals logic follows python syntax. Here are some options:

Number == 4 #Check if Number is Equal to 4Number != 4 #Check if Number is Not Equal to 4Number > 4 #Check if Number is greater than 4Number < 4 #Check if Number is less than 4Number >= 4 #Check if Number is greater than or equal to 4Number <= 4 #Check if Number is less than or equal to 4

Conditionals follow python syntax and options. There are several options for strings and lists:

== #Check if strings equal!= #Check if strings not equalin #Check if string is in another string

Date comparisons in python follow the same syntax as number comparisons.

== #Check if dates equal!= #Check if dates not equal> #Check if date is after< #Check if date is before>= #Check if date is after or equal<= #Check if date is before or equal

Following python syntax, comparisons are case sensitive and will evaluate false if two strings have different capitalization. Python string methods such as .lower() and .upper() can be useful if you want to avoid case sensitivity.

Checking a variable for containing a value can be done in python by `if <var>: `

Similarly, with the conditional module we can check a variable containing a value by dragging it into the conditional blank:

In this example, if `sample_list`

contains a value, the conditional will return true.

The `not `

keyword can be used to check for the emptiness of a list or dictionary.

In this example, since `sample_list `

does not contain any values, our conditional expression will evaluate as true.

Conditional modules support the use of parenthesis to use an order of operations while evaluating.

â€‹

Please see the "Has changed" Module for comparisons used in conjunction with "has changed" or "changed by" logic.

By pressing the **+ Add Condition** button, you can add additional conditions.

**And:**Use if you want your expression to evaluate to`True`

only whenconditions are*both*`True`

.**Or:**Use if you want your expression to evaluate to`True`

whenof your conditions are*at least one*`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 above image, our variable Number is equal to 4. Since we first evaluate the left most branch ( the if statement ) we see that our Number is not greater than 10. Therefore this evaluates as false and then we move right to the Else If branch. This branch checks to see if Number is equal to 5. Since Number is 4, this evaluates as false and our else branch is True.