CheckFirst
  • CheckFirst
  • Get started
    • Tutorials
      • Yes/No
      • Quiz
      • Constants table
      • Date calculator
      • Complex example
    • Logic Syntax
  • Features
    • Questions
    • Constants
    • Logic
      • Calculator logic
      • Conditional logic
      • Date logic
      • Map constant
      • Results formatting
    • Settings
  • FAQ
    • Full Logic Syntax List
  • Contact Us
  • Updates
Powered by GitBook
On this page
  • IF statements
  • Additional conditions AND/OR
  • THEN/ELSE
  • Display a text result
  • True/false statement
  • Return a number

Was this helpful?

  1. Features
  2. Logic

Conditional logic

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

PreviousCalculator logicNextDate logic

Last updated 3 years ago

Was this helpful?

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 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:

  1. To

  2. As a

  3. To

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:

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:

display a text result
true false statement
return a number
list of functions
We used the outcome of logic blocks O1-O4 to help our formula in O8.
3/4 correct answers gives us a pass!
Anything less than 3/4 correct answers gives us a fail:(