Skip to main content
How to create a decision tree with logic within your exercise?
Thijs Gillebaart avatar
Written by Thijs Gillebaart
Updated over a week ago

Would you like to give a student extra help questions when they have answered a question incorrectly? Or would you like to skip certain subquestions if the student answers the first question correctly?

You can use conditional logic within an exercise to achieve this. This provide great didactic possibilities to personalise each exercise based on the answers of that specific student.
In this article we will explain how to create an exercise with conditional logic.

Exercises with conditional logic can't be used within tests yet. Therefore you won't see the "link to test" button if you have selected a conditional exercise.

Setting up your first conditional exercise

Setting up a conditional exercise takes 3 steps.

  1. Enable conditional logic

  2. Define the actions triggered by a student answering a (sub)question incorrectly and correctly

  3. Define the actions triggered by a student giving a specific answer (optionally)

  4. Save the exercise

1. Enable conditional logic

You can enable (and disable) the logic in an exercise by clicking "more" and then selecting "Toggle conditional logic".

Note that in order for toggling (activation) of conditional logic to become available, there must first be sub-questions, and they must be saved, i.e. the exercise should be saved as draft by clicking save as draft on the top-right, or published. Only then will the conditional logic option become available.

When enabling the conditional logic, the actions of the first question will be set to "Complete exercise". That means if the question is answered correctly the exercise is completed. If you go to preview now, you won't see the subquestions anymore, since they are not triggered by any action.
Next step is to specify an action in the first question to trigger subquestions.

2. Define actions in a (sub)question

To specify an action in a question, click on the button "edit logic" in the top right corner of the question you would like to add actions to.

This will open up the logic editor for that (sub)question. Here you can specify the actions that will be triggered if the student:

  • answers correctly

  • answers incorrectly

For both events (answering correctly and incorrectly) you can specify the action by clicking on the current action.

There are two type of actions:

  • Show a next sub-question
    With this action you specify which question to show after a student correctly or incorrectly answers the question. The numbers are the subquestion identifiers, which you can find in the top left of each subquestion.
    You can only select subquestions which are below the question you are specifying the logic for.

  • Complete the exercise
    With this action you can specify that the exercise is done. For example: by specifying this action in the first question if the student answers correctly, the student will have finished the complete exercise.

When you have selected the desired actions, you can click on "save & close". You can repeat this process for each (sub)question to build your logic.

3. Define actions for specific answers

Apart from defining actions for the generic correct and incorrect scenarios it is also possible to define actions for when a student provides a specific answer. This enables you to, for example, skip a sub-question if the answer of a student shows that they already master a certain sub-step.

For each type of question the configuration of the actions for answers can be defined alongside the other configuration options. For an open answers this is in the 'edit specific feedback modal:

And for multiple choice answers this on top of the feedback for an answer:

Note: the action attached to an answer will only be triggered when the question is completed, so only when the student gave a correct answer or used up all of their answer attempts. By default this means that answer rules for incorrect answers are not executed when they are triggered for the first time. To immediately trigger an action configured for an answer rule you need to configure the question to only allow one answer attempt.

4. Save the exercise

When you are done with updating the exercise, don't forget to save the exercise by using the save button in the top right corner.

If you are adding new subquestions, these won't be available for selection until
you've saved them. To save new subquestions, you save the complete exercise. See step 3 above.

If you have any questions regarding decision trees or conditional logic, please reach out to us via the chat icon in the bottom right corner.

Did this answer your question?