# Personality quiz

> Learn how to create a personality quiz using variables and conditions. Discover how to calculate scores per profile and display the matching result.

https://docs.pandasuite.com/essentials/gamification/personality-quiz/

**Create a personality quiz that assigns a profile to the user based on their answers. Each answer increments the score of a specific profile, and the profile with the highest score is displayed at the end.**

[Video: Personality quiz template demo: “What kind of creator are you?”, five questions with three answers each, then the Creative Strategist profile]

[Template: Personality Test](https://pandasuite.com/templates/personality-test/)

## How a personality quiz works

A personality quiz relies on a **score calculation system** based on user responses. The logic is simple:

1. **Each profile has its own variable** (e.g., profile\_explorer, profile\_creative, profile\_strategist)
2. **Each answer increments the score of a specific profile**
3. **At the end of the quiz, scores are compared** using [conditions](https://docs.pandasuite.com/essentials/components/condition/)
4. **The screen for the winning profile is displayed**

> **Info**
>
> This tutorial is suitable for beginners with basic knowledge of
> [variables](https://docs.pandasuite.com/essentials/data/variables/) and
> [conditions](https://docs.pandasuite.com/essentials/components/condition/).

## Step 1: Create score variables

Create a [variable](https://docs.pandasuite.com/essentials/data/variables/) for each possible profile.

1. Add a **Datastore** at the **Project** level
2. Click **Add property** for each profile
3. Choose the **Number** type and set the default value to `0`

**Example with 3 profiles:**

- Variable `score_explorer`: Number = 0
- Variable `score_creative`: Number = 0
- Variable `score_strategist`: Number = 0

## Step 2: Increment scores based on answers

For each answer button, configure an action that **increments** the corresponding profile variable.

1. Select an answer button
2. Go to **Actions** > trigger **Tap / click**
3. Add the action **Interact with a data source** > **Datastore**
4. Choose **Create/Update Data (Local)** > select the profile variable
5. Function: **Increment** > Value: `1`

**Example:** The button "I love exploring new places" increments `score_explorer` by 1.

> **Tip**
>
> You can increment by different values depending on the importance of the
> question (e.g., +2 points for certain key questions).

## Step 3: Compare scores at the end of the quiz

After the last question, use a **Condition** component to determine which profile has the highest score.

1. Add a **Condition** component at the **Project** level
2. Create one condition per profile (e.g., "Explorer Profile Winner")
3. Configure the expressions to compare scores:

**Example for "Explorer Profile Winner":**

- Expression 1: `score_explorer` **Greater than or equal to** `score_creative`
- Logic: **AND** (all expressions must be true)
- Expression 2: `score_explorer` **Greater than or equal to** `score_strategist`

Repeat this configuration for each profile.

> **Warning**
>
> You can handle ties by adding additional conditions or defining a priority
> order.

## Step 4: Display the correct profile

Configure navigation to the result screen corresponding to the winning profile.

1. Select the last button (or transition screen)
2. In **Actions** > trigger **Tap / click**
3. Add the action **Trigger** > select your **Condition** component > **Evaluate**
4. In the **Condition** component, for each profile condition:
   - Trigger: **Condition evaluation**
   - Action: **Go to screen** > select the corresponding profile screen

**Example:** When "Explorer Profile Winner" is true, the action **Go to screen** redirects to "Explorer Result Screen".

## Video tutorial (older method)

The video below presents an older alternative method using a simple correct answer counter instead of a score-per-profile system. While functional, the approach described in this tutorial (with multiple variables and conditions) is more flexible and recommended for creating comprehensive personality quizzes.

[Video: Older tutorial: creating a personality quiz with a simple correct answer counter](//www.youtube.com/embed/Q4tDMUoKHDw?autoplay=0&showinfo=0&)

## Going further

- [Variables](https://docs.pandasuite.com/essentials/data/variables/): understand how variables work
- [Condition](https://docs.pandasuite.com/essentials/components/condition/): master conditions and logic
- [Score](https://docs.pandasuite.com/essentials/gamification/score/): discover other scoring mechanisms
