# Conditional Logic

Source: https://docs.rooquiz.com/en/editor/logic

> Conditional logic shows or hides later questions based on earlier answers, turning a fixed questionnaire into an adaptive one. How a rule reads, which quiz types support it, and how hidden questions affect scores and outcomes.

Conditional logic **shows or hides later questions** based on how someone answers, turning a fixed questionnaire into an adaptive one.

<Callout type="info">
  Conditional logic is available in **Scored Quiz** and **Outcome Quiz**. Knowledge Quiz and AI Quiz have no **Rules** tab in the editor's right panel — hiding questions would change a knowledge quiz's full marks and accuracy.
</Callout>

## What a rule looks like

A rule reads as a sentence: **If … then show / hide a question.**

In the **Rules** tab of the editor's right panel, click **+ Add Rule** and fill in:

| Part     | Notes                                                                                     |
| -------- | ----------------------------------------------------------------------------------------- |
| **If**   | Pick an **earlier question**, an operator, and a value                                    |
| **and**  | Keep going with **Add Condition**; conditions within one rule are ANDed, so all must hold |
| **then** | Choose **Show** or **Hide**, then pick the **target question**                            |

A quiz can hold several rules, listed as **Rule 1 / Rule 2** and so on.

## Available operators

| Operator                                                                            | Use with                                                           |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| **equals**                                                                          | Single choice, true/false                                          |
| **contains any / not contains any**                                                 | Multiple choice — matches if any of the chosen options is selected |
| **greater than / greater than or equal / less than / less than or equal / between** | Numeric answers                                                    |

True/false questions offer **✓ True** and **✗ False**.

<Callout type="info">
  A **condition** can only reference a question with a definite value (single choice, multiple choice, dropdown, true/false, rating, number). A **target** is broader — fill-in-the-blank, Rich Text and Image Carousel blocks can be shown or hidden too, which is how you build an "ask them to explain only when they picked Other" follow-up.
</Callout>

## Setting one up

<Steps>
  ### Build the questions first

  Rules reference specific questions, so both the trigger and the target must already exist.

  ### Add the rule

  Pick the question → the operator → the value → show or hide → the target question. Saving an incomplete rule tells you to **fill in the rule completely**.

  ### Walk it through in preview

  Try each answer path. Once you have more than a couple of rules, reasoning about them in your head reliably misses a case.
</Steps>

## Things to watch

* Reference questions that come **before** the target. Pointing at a later question means the answer doesn't exist yet when the condition is evaluated.
* Hidden questions aren't shown and **aren't required-checked either**, so they never block submission.
* Deleting a rule asks for confirmation; afterwards the target question returns to being shown by default.

<Callout type="info">
  Hiding questions affects results. In a **Scored Quiz**, a question that never appeared has no answer and contributes no points — make sure your [scoring rules](https://docs.rooquiz.com/en/editor/scoring) line up with the questions that may be hidden. In an **Outcome Quiz**, a hidden question casts no votes, so a quiz that uses rules picks the winner by **vote share** instead of raw votes — see below.
</Callout>

## Outcome quizzes: vote share

Without rules, an outcome quiz picks the type with the most votes. Once a quiz has rules, different respondents see different questions, and a type backed by a long follow-up branch could win just by collecting more votes. So a quiz with rules compares each type's **share of the votes it could have received** from the questions that respondent actually saw:

* Share = (votes received + 0.5) ÷ (votes it could have received + 1). The small smoothing stops a type that only one question votes for from winning on 1 out of 1.
* A type no visible question votes for gets 0.
* Ties fall back to raw votes, then to the order of your outcome list.

Under your outcome types, the editor runs an **Outcome coverage check** across every answer path. It flags a type that can never be the result, and lists the paths on which a type can't get any votes. It only warns — saving still works — but a flagged type usually means a branch needs a question that votes for it.
