# Logic and branching

Canonical page: https://www.questionpunk.com/support/survey-design-logic-branching

Use logic to create targeted paths and reduce respondent fatigue.

Time: 10-30 minutes

Level: Intermediate to Advanced

Audience: Researchers, Survey designers

## Steps

### 1. Open branching rules

Click a question in the editor, then look for the branching or logic options. You can add rules that evaluate previous answers.

### 2. Set conditions with AND/OR groups

Create rule groups using AND (all conditions must match) or OR (any condition matches). Nest groups for complex logic.

### 3. Use display logic

Display logic shows or hides a question based on previous answers. This is different from branching, which changes the overall flow path.

### 4. Combine with AI interview modes

AI interviews support an "AI decides" question mode where the AI chooses when to stop asking follow-ups based on your guidance criteria. This complements branching logic by letting the AI control depth within a single interview question.

### 5. Use carry-forward for follow-ups

Use [carry-forward](https://www.questionpunk.com/support/carry-forward) to dynamically populate a follow-up question with only the options the respondent selected (or did not select) in an earlier question.

### 6. Set quotas to cap segments

Use [quotas](https://www.questionpunk.com/support/quotas-response-limits) to set per-option response targets. When a quota bucket is full, new respondents matching that segment are terminated automatically.

### 7. Validate with the flow canvas

Use the [survey flow canvas](https://www.questionpunk.com/support/survey-flow-canvas) to visualize all branching paths and ensure there are no dead-ends.

## Details

Branch respondents based on previous answers to ask relevant follow-ups and skip irrelevant sections. QuestionPunk supports AND/OR rule groups for complex conditions.

Display logic lets you show or hide individual questions without changing the overall flow. Branching rules redirect respondents to entirely different sections.

[Carry-forward](https://www.questionpunk.com/support/carry-forward) dynamically populates a follow-up question based on which options the respondent selected (or skipped) earlier, eliminating redundant option lists.

[Quotas](https://www.questionpunk.com/support/quotas-response-limits) let you set numeric targets per answer option or URL parameter value. When a bucket is full, new respondents matching that segment are terminated with an optional custom end screen.

URL parameter-based display logic lets you show or hide questions based on values passed in the survey link (embedded data), useful for panel routing and A/B testing.

For adaptive depth within a single question, AI interviews support an "AI decides" mode where the AI determines when it has enough information and stops probing. You configure minimum/maximum follow-ups and stopping guidance.

Test all branching paths thoroughly using the preview and synthetic testing to avoid dead-ends.

## Related articles

- [Create your first survey](https://www.questionpunk.com/support/create-your-first-survey.md)
- [Question types guide](https://www.questionpunk.com/support/survey-design-question-types.md)
- [Survey flow canvas](https://www.questionpunk.com/support/survey-flow-canvas.md)
- [Carry-forward between questions](https://www.questionpunk.com/support/carry-forward.md)
- [Quotas and response limits](https://www.questionpunk.com/support/quotas-response-limits.md)
