Using and/or with Logic

When you set up your Logic, be sure to use "and/or" correctly. If you don't, your form might not work properly. This article will give you an example and explain 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?’.

The form builder interface showing the initial Cat or Dog question branching to a follow-up question about pineapple on pizza.

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.

An Ending Screen tailored specifically for cat owners who enjoy pineapple on pizza.

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

An Ending Screen tailored specifically for dog owners who enjoy pineapple on pizza.

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

A common alternative Ending Screen asking respondents about pickles on pizza instead.

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

The Logic panel displaying the first two successful conditional rules for routing respondents based on their pizza preferences.

But the last condition cannot be satisfied, and will break your form! 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.

An incorrect and impossible Logic condition evaluating if a respondent selected both Cat AND Dog simultaneously.

The solution is to use or instead of and.

The corrected Logic setup utilizing the OR operator to properly handle either Cat or Dog selections combined with pizza preferences.

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, remember 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 form will not work.

Was this article helpful?

Have more questions? Submit a request

Tap into our community knowledge

Find answers

Can’t find what you’re looking for?

Contact support