Conditional logic

Allows you to set certain conditions or criteria to be met in order to display an outcome or do an action.

There are 2 parts to conditional logic, IF statements and THEN/ELSE statements.

IF Set your conditions ––––––––––––––––––––––––––––––– THEN If conditions are met, do this ELSE If conditions are not met, do this

See our list of functions you can use to set your conditions.

IF statements

Additional conditions AND/OR

You can choose to add more conditions to your IF statement with additional AND or OR statements.

AND

OR

IF Condition 1

AND Condition 2

AND Condition 3

IF Condition 1

OR Condition 2

OR Condition 3

THEN Do action A

ELSE Do action B

THEN Do action A

ELSE Do action B

If all conditions 1, 2 and 3 are met, then do action A.

If not all conditions 1, 2 and 3 are met, then do action B.

If either condition 1, 2 or 3 is met, do action A.

If neither condition 1, 2 or 3 is met, do action B.

In one IF/ELSE logic block, all additional conditions have to either be AND statements or OR statements. We do not allow users to use a mix of AND or OR statements in one logic block.

THEN/ELSE

There are 3 ways to use THEN/ELSE statements:

View how each method would look like if shown in the results section:

Display a text result

Pro tip: Use quotation marks ("") around a string of text to display it as a text result.

Example 1: Giving a specific number

If N1 is certain number, then show some text otherwise show other text

Plaintext

Logic

IF a user has input the number 5,

THEN show the text "You have chosen the number 5"

ELSE show the text "You have not chosen the number 5"

IF N1==5

THEN "You have chosen the number 5"

ELSE "You have not chosen the number 5"

Example 2: Choosing a specific option

If R1 is certain string of text, then show some text otherwise show other text

Plaintext

Logic

IF a citizen has selected the option “Dog”,

THEN show the text “You like dogs!”

ELSE show the text “Seems like you like other animals”

IF R1 == “Dog”

THEN “You like dogs!”

ELSE “Seems like you like other animals”

True/false statement

For complex checkers, we may want to have several layers of checks in a checker. We can use the outcome of a logic block as a condition to be fulfilled in another logic block.

If N1 is certain number, then condition is true otherwise false.

Plaintext

Logic

IF a user has input a number more than 5,

THEN condition has been met

ELSE condition has not been met

IF N1>5

THEN true

ELSE false

Use case example

True/false statements can be used in many ways, here we are using them to tell us if an answer was right or wrong for a question.

Next, we need to count the total score. we'll use the function countif to do this: Out of logic blocks O1 to O4, count which are true.

countif([O1,O2,O3,O4],true)

We can now take this total score, and find out if it is a pass or fail. Anything more than 2/4 questions is a pass, else it's a fail.

Save draft and preview your outcome.

True/False statements can also be interpreted as 1/0 by logic blocks.

Return a number

In quiz formats, it's may be more useful to count if an answer was Correct/Incorrect based on how many points are awarded. This would help simplify our calculations of their total score.

If N1 is certain number, then give 1 point otherwise give 0 points

((O2+O3+O4+O5)/4)*100

The outcome would look like this:

Last updated