Skip to main content

The 4 Variable Types

String

Text values (words, sentences, single letters)

Number

Numeric values (integers and decimals)

Boolean

True or false only

Array

A list of values (ordered collection)
Variable editor showing Type dropdown set to Number with Default Value, Allowed Values, and Min/Max fields

The Type dropdown lets you choose from String, Number, Boolean, or Array — along with Default Value, Allowed Values, and Min/Max constraints

String

What it is: Text values — words, sentences, single characters, or any string of characters. Default value: Usually "" (empty string) 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:
Using strings in conditions:

Number

What it is: Numeric values — integers (whole numbers) or decimals (numbers with a point). Default value: Usually 0 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:
Using numbers in conditions:

Boolean

What it is: A value that is either true or false — nothing else. Default value: Usually false or true 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?)
  • Gate features (has learner watched the intro?)
  • Status flags (is this section unlocked?)
Example variables:
Using booleans in conditions:
Booleans are simple and fast. Use them for simple on/off states instead of strings like “complete”/“incomplete”.

Array

What it is: An ordered list of values. Each item in the list is accessed by its position (1st item, 2nd item, etc.). Default value: Usually [] (empty array) or an initial list like ["step1", "step2"] Examples:
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:
Using arrays in conditions:

Choosing the Right Type: Quick Reference

Use this table to decide which type to use:

Type Compatibility and Conversion

Be careful when mixing types:
When building conditions, make sure you’re comparing the right types. A string “80” is different from a number 80. If you’re comparing numbers, make sure both are numbers.

Default Values Matter

Every variable must have a default value. Choose defaults carefully: Defaults are important because your conditions rely on them. If a variable starts undefined or null, some conditions might fail.

Best Practices

Changing types later can break conditions and actions. Plan ahead.
Strings, numbers, and booleans are easier to work with than arrays. Use them unless you really need a list.
Instead of answer1, answer2, answer3, use one selectedAnswers array.
Empty strings, zero, false, [] — use sensible defaults so conditions work correctly.

Next Steps

Learn about: