The 4 Variable Types
Text values (words, sentences, single letters)
Numeric values (integers and decimals)
True or false only
A list of values (ordered collection)

To create a variable, click Add Variable and choose String, Number, Boolean, or Array from the menu. The variable card provides Name, Type, and Description fields; String variables also provide Pattern (Regex). Use the card's Type dropdown to change an existing variable's type.
New variables start at the type defaults below; use Set Variable actions for other initial values. Existing stored defaults are preserved when the type is unchanged.
Create each variable before using it in an action or condition. In Set Variable, select the variable, then choose Set Value for a literal value or Set Expression for a calculation. Enter only the calculation in Set Expression, such as score + 10, without an assignment or {{ }}.
String
What it is: Text values — words, sentences, single characters, or any string of characters.
Default value: "" (empty string) for a new variable. Use Set Variable to assign other text.
Examples:
"correct"(single word)"John Smith"(multiple words)"Safety-Procedure-001"(identifier with special characters)"The valve is open."(sentence)""(empty)
When to use:
- Store the learner's name, username, or email
- Store selected answers ("Option A", "Door B")
- Store status values ("open", "closed", "waiting")
- Store IDs or codes
Example variable:
Variable Name: selectedAnswer
Type: string
Automatic starting value: ""
To record an Option A choice, configure a Set Variable action in the training logic that handles that choice:
Variable: selectedAnswer
Set Value: Option A
On a later transition, use selectedAnswer == "Option A" as the condition and select the appropriate destination step.
Using strings in conditions:
selectedAnswer == "correct"
userName === "admin"
feedbackText !== ""
Number
What it is: Numeric values — integers (whole numbers) or decimals (numbers with a point).
Default value: 0 for a new variable. Use Set Variable to assign another starting number.
Examples:
0,1,100(integers)3.14,0.5,99.99(decimals)-10(negative)
When to use:
- Store scores or points
- Store attempt counts
- Store time values (in seconds or milliseconds)
- Store percentages or ratings
- Store object positions or angles
Example variables and actions:
Create Number variables score, attempts, startTime, and elapsedSeconds. Each starts at 0. Configure Set Variable actions as follows:
| Variable | Set Expression | When to run the action |
|---|---|---|
score | score + 10 | When awarding 10 points for a successful task. |
attempts | attempts + 1 | When a new attempt begins. |
startTime | now() | Once, when the timed task begins. |
elapsedSeconds | (now() - startTime) / 1000 | Later, when you need the elapsed time or the task finishes. |
now() returns a timestamp in milliseconds. Capture startTime when timing begins and keep it unchanged until the measurement is complete. Dividing the difference by 1000 gives seconds. elapsedSeconds updates whenever its Set Variable action runs.
Using numbers in conditions:
score >= 80
attempts < 3
elapsedSeconds > 120
Boolean
What it is: A value that is either true or false — nothing else.
Default value: false for a new variable. Use Set Variable to initialize true when required.
Examples:
true(yes, complete, open, on)false(no, incomplete, closed, off)
When to use:
- Track yes/no states (is something complete? is it open?)
- Track toggles (is audio enabled? is advanced mode on?)
- Track completion of required tasks (has the inspection been completed?)
- Status flags (is this section unlocked?)
Example variables:
Create these as Boolean variables. Each starts at false:
| Variable | Use |
|---|---|
isQuizComplete | Set to true when all required quiz questions have been completed. |
isInspectionComplete | Set to true when the required inspection task is completed. |
audioEnabled | Use in conditions to choose a path that plays audio. Set to true in the starting step if that path should be enabled initially. |
For example, add this Set Variable action to the transition that records successful completion of the inspection:
Variable: isInspectionComplete
Set Value: true
A flag stores a value. Configure the actions that update it and the conditions that use it in your training flow.
Using booleans in conditions:
isQuizComplete == true
isInspectionComplete == false
audioEnabled == true
Array
What it is: An ordered list of values. Access items using an index starting at 0: completedSteps[0] is the first item, and completedSteps[1] is the second.
Default value: [] (empty array) for a new variable. Use Set Value with a JSON array to assign a list, or Set Expression to calculate an updated list.
Examples:
// List of completed steps
["Read instructions", "Identify valve", "Turn valve"]
// List of answers
["Option A", "Option B", "Option A"]
// List of numbers (scores from multiple attempts)
[85, 92, 78]
// Empty array
[]
When to use:
- Store a list of items (completed steps, selected choices)
- Store a history (previous scores, timestamps)
- Track multiple related values in order
Example variable:
Variable Name: completedSteps
Type: array
Automatic starting value: []
Add an entry after the trainee completes the corresponding task. For example, on the transition that records successful completion of Identify valve, add:
Variable: completedSteps
Set Expression: concat(completedSteps, ['Identify valve'])
With an initially empty list, this stores ["Identify valve"]. Add each task only once when using the list length as a count of distinct completed tasks.
Use len(completedSteps) >= 3 as a condition to check whether at least three tasks have been recorded. For a training with five tasks, display progress in a Show Text or Show Panel Body:
You've completed {{len(completedSteps)}} of 5 tasks.
Using arrays in conditions:
len(completedSteps) >= 3 // At least 3 items
len(selectedAnswers) == 10 // Exactly 10 answers
len(completedSteps) > 0 // Array is not empty
Choosing the Right Type: Quick Reference
Use this table to decide which type to use:
| Data | Type | Why |
|---|---|---|
| A learner's name, username | string | Text value |
| Score, points, count | number | Numeric value |
| Answer to a multiple-choice question | string | Text value ("Option A") |
| Is something complete? Open? | boolean | Yes/no only |
| Number of attempts | number | Numeric value |
| Elapsed time (seconds) | number | Numeric value |
| List of visited states | array | Ordered list of items |
| Quiz answers for 5 questions | array | List of answers |
| Multiple scores from retries | array | List of numbers |
| A flag (audio enabled, inspection complete) | boolean | Yes/no only |
Type Compatibility
Use matching types when comparing values and assigning a result with Set Variable. A Number variable requires a numeric result, a Boolean requires true or false, and an Array requires an array.
score == 80 // Compare a Number with a number
selectedAnswer == "Option A" // Compare a String with text
isQuizComplete == true // Compare a Boolean with true
The + operator adds numbers or joins text. The == operator can compare different types by converting them during comparison; === also requires matching types:
| Expression | Result | Explanation |
|---|---|---|
80 + 20 | 100 | Adds two numbers. |
"80" + 20 | "8020" | Joins the text "80" with 20. |
80 == "80" | true | Allows type conversion during comparison. |
80 === "80" | false | Number and String are different types. |
len([85, 92, 78]) | 3 | Counts array items. |
clamp(120, 0, 100) | 100 | Constrains a number to the given range. |
len() returns the length of a string or array. clamp() requires numeric arguments and constrains a number. Neither function converts numeric text into a number. Choose Number variables and numeric values for arithmetic.
Starting Values
Creator assigns these defaults to new variables automatically:
| Variable | Type | Automatic default | Meaning in this example |
|---|---|---|---|
score | number | 0 | No points yet. |
selectedAnswer | string | "" | No answer selected. |
isQuizComplete | boolean | false | Quiz not completed. |
completedSteps | array | [] | No tasks recorded as completed. |
The Variables pane does not expose an editable Default Value field. For another starting value, add a Set Variable action in the starting step before actions that read it. For example, create a Number variable passingScore, then select it in Set Variable and use Set Value to enter 80.
Changing a variable's Type resets its default to the new type's default. Review actions and conditions that use the variable after a type change. Existing stored defaults are preserved when the type stays the same.
Best Practices
Pick the right type from the start
Changing types later can break conditions and actions. Plan ahead.
Use simple types when possible
Strings, numbers, and booleans are easier to work with than arrays. Use them unless you really need a list.
For lists, use arrays
Instead of answer1, answer2, answer3, use one selectedAnswers array.
Initialize values before using them
Review the automatic defaults and use Set Variable for other starting values. Initialize each value before actions or events that depend on it.
Next Steps
Learn about:
- Creating Variables — Create variables in your training
- Variable Interpolation — Use variables in text
- Conditions — Use variables to control training flow

