Skip to content

Variables

Variables are course state that changes as a learner progresses. You define them per module, manipulate them with component actions, and use them as conditions for achievements or other actions. You'll find them in the editor under Course contentVariables, grouped by module.

Types

A variable is either Boolean or Integer:

TypePossible values
Booleantrue or false
Integerany whole number, positive or negative

Each variable also has an initial value that it starts at when the learner enters the course.

Custom vs quiz modules

  • Custom modules — you define your own variables. Useful for tracking arbitrary progression: a slide visited, a question answered correctly, a counter for clicks, and so on.
  • Quiz modules — variables are built-in and not editable. Currently the only quiz variable is the correct-answer count, which is automatically maintained as the learner answers questions.

The Add New Variable button only appears when at least one custom module exists in the course; it always creates the variable inside a custom module.

Creating, editing, deleting

Click Add New Variable to open the form:

  • Module — pick which custom module the variable belongs to.
  • Name — up to 255 characters.
  • Type — Boolean or Integer.
  • Initial valuetrue / false for Boolean, a number for Integer.

When editing an existing variable, module and type are locked — only the name and initial value can change. To change the type or move it to a different module, delete the variable and create a new one. (Deleting also removes any conditions or component actions that reference it.)

Quiz variables don't have edit or delete buttons; they're maintained automatically.

Using variables

Variables are read and written in two main places:

  • Component actions — in custom modules, components react to events (click, hover, load, …) and can set, increase, or decrease a variable's value.
  • Conditions — places that branch on variable state, including achievements and other component actions.

Condition operators

A condition compares a variable to a value. The available operators depend on the type:

Variable typeAvailable operators
Boolean=,
Integer=, , <, , >,

For quiz modules, the conditions editor wraps the correct-answer count in a single toggle (Quiz finished successfully / Quiz not finished successfully) — the threshold follows the quiz's own Questions to pass setting automatically.

See also

  • Achievements — using variable conditions to award progress markers.
  • Basic terms — orientation on modules, variables, and the rest.