Getting Started

Library

Account Management

Other Information

Conditionals

Choose a branch of logic based on a condition.

â€‹ Condition Block

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.

â€‹ Number Comparison Options

ðŸ”¢

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

1

Number == 4 #Check if Number is Equal to 4

2

Number != 4 #Check if Number is Not Equal to 4

3

Number > 4 #Check if Number is greater than 4

4

Number < 4 #Check if Number is less than 4

5

Number >= 4 #Check if Number is greater than or equal to 4

6

Number <= 4 #Check if Number is less than or equal to 4

Copied!

â€‹ Text Comparison Options

ðŸ”¤

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

1

== #Check if strings equal

2

!= #Check if strings not equal

3

in #Check if string is in another string

Copied!

â€‹ Date Comparison Options

ðŸ“†

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

1

== #Check if dates equal

2

!= #Check if dates not equal

3

> #Check if date is after

4

< #Check if date is before

5

>= #Check if date is after or equal

6

<= #Check if date is before or equal

Copied!

â€‹ Case Sensitive

ðŸ”

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 for Values

âœ”

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. â€‹ Parenthesis

âž•

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

Returns True since both variables contain a value and one condition is met in the first set of parenthesis.

â€‹

â€‹ "Changed By" Comparisons

ðŸ“ˆ

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.

â€‹ Logical Operators

ðŸ’¡

**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`

.

â€‹ **If / Else-If / Else**

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.

Last modified 9mo ago