Signup

Using and/or with Logic

When setting up your Logic, make sure you use and/or correctly, or your form might not work correctly. This article gives you an example and explains how to use and/or.

Here’s a common mistake with and/or

This form asks ‘Are you a cat or a dog person?’. The answer will send them down different logic paths, and later we ask both groups ‘So now, pineapples on your pizza?’.

andor1.png

From question 4, we want to send people to different custom Ending Screens.

If you’re a cat person who likes pineapple on pizza you see this.

And_Or_Logic_02.png

If you’re a dog person who likes pineapple on pizza you see this.

And_Or_Logic_03.png

But if you’re either a dog or a cat person who doesn’t like pineapple on pizza, we want to show this.

And_Or_Logic_04.png

On the pizza question, there are three logical conditions, sending respondents to the Ending screens. The first two work.

andor_1.png

andor_2.png

But the last condition cannot be satisfied, and will break your typeform! Why? Because it’s impossible for someone to have answered Cat and Dog to the question ‘Are you a cat or a dog person?’. Have a look.

andor_3.png

The solution is to use or instead of and.

andor_4.png

In this way, people who like Cats or Dogs and don’t like pineapple on pizza will see the Ending Screen ‘OK, how about pickles on pizza?‘.

HC_Note_ilu_cropped.png
Note! If your Logic has multiple conditions like the above, bear in mind that 'and' will be executed first and 'or' will be executed later. When you use 'and', this means that two of the conditions must be satisfied at the same time. Make sure that this is possible, or your Logic will fail.
HC_Warning_ilu_cropped.png
Warning! Be careful when using and/or with Logic – if they create impossible scenarios, your typeform will not work.

Tap into our community knowledge