Conditional logic
Allows you to set certain conditions or criteria to be met in order to display an outcome or do an action.
Last updated
Allows you to set certain conditions or criteria to be met in order to display an outcome or do an action.
Last updated
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.
You can choose to add more conditions to your IF statement with additional AND or OR statements.
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.
There are 3 ways to use THEN/ELSE statements:
As a true false statement
View how each method would look like if shown in the results section:
Pro tip: Use quotation marks ("") around a string of text to display it as a text result.
If N1 is
certain number
, then showsome text
otherwise showother text
If R1 is
certain string of text
, then showsome text
otherwise showother text
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 istrue
otherwisefalse
.
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.
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.
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
, thengive 1 point
otherwisegive 0 points
The outcome would look like this:
Using a numeric question, we can get a user to input a number. Based on their input, let's show a sentence.
Using a radio question, we can get a user to pick a choice. Their choice is seen as a string of text. Based on their choice (i.e. certain string of text), let's show a sentence.
Let's first set the right answer for each question using aconditional logic block. If the condition is satisfied (the input was the right answer), then true
(correct), else false
(wrong).
We can then use acalculated logic block with the formula below to tally up their total score out of 100:
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.
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"
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”
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