# Logical Programming – How to clarify conditions for better survey logic

Logic is an important part of many online surveys. Using logic gives survey designers complete control over a respondent’s path through the survey based on data already collected. However, it is important that logic is clear so that programmers know exactly what the survey designers had in mind. Sometimes even little details can have a big impact.

#### AND versus OR

If a question uses multiple logic conditions, be sure to clarify whether all conditions must be met (AND) or if only one condition must be met (OR).

• Example of unclear logic ASK IF B5 = 1, ASK IF C1 = 2
• Good logic, version 1: ASK IF B5 = 1 AND IF C1 = 2
• Good logic, version 2: ASK IF B5 = 1 OR IF C1 = 2

Although just one word is different in the good logic examples, they would work differently within the survey. In the first good logic version, this would show the item only if both specifications are met. In the second, this would show the item if either, or both, specification is met. In the example of unclear logic, it’s not clear which way it should be setup. Different people may assume this in different ways, and assumptions can lead to misinterpreted logic, more work, and potentially more costs down the road.

#### Using Parentheses

Parentheses can be key to determine exactly what logic is needed. The examples below show that although the text is the same, the placement of the parentheses completely change the logic.

• Example of unclear logic: ASK IF B5 = 1 AND C1 = 2 OR C2=2
• Good logic, version 1: ASK IF (B5 = 1 AND IF C1 = 2) OR C2=2
• Good logic, version 2: ASK IF B5 = 1 AND (IF C1 = 2 OR C2=2)

In version 1, the question is asked only if either(B5 =1 and C1=2) OR in the case that C2=2.

In version 2, the question is asked only if both B5=1 AND C1=2 or C2=2.

#### Logic Based on Multi-Choice

When referring to multi-choice questions, be sure to note whether all or any of the listed answer options must been selected. For example:

• Example of unclear logic: ASK IF D5 = 1, 2, 3
• Good logic, version 1: ASK IF D5 = all of 1, 2, 3 (alternatively: 1 and 2 and 3)
• Good logic, version 2: ASK IF D5 = any of 1, 2, 3 (alternatively: 1 or 2 or 3)

The unclear logic example can be interpreted either way, which can lead to incorrect logic.