Skip to main content
The syntax is simple: wrap the variable name in double curly braces: {{variableName}}

Basic Syntax

When this text is displayed:
  • {{userName}} is replaced with the value of the userName variable
  • {{score}} is replaced with the value of the score variable
Example:
  • If userName = "John" and score = 95
  • The text becomes: "Hello John, you scored 95 points."

Common Uses

Interpolation works in any text field in the Creator App. Here are the most common uses:

Show Text Action

Panel Titles and Descriptions

Feedback Messages

All Variable Types

Interpolation works with all variable types:

String Variables

Number Variables

Boolean Variables

Note: Booleans display as “true” or “false”. For user-friendly text, use a ternary expression (see below).

Array Variables

Arrays don’t interpolate directly (you can’t display the whole list). Use functions like len() to work with them.

Advanced: Using Expressions in Interpolation

In addition to simple variable names, you can use expressions inside {{ }}. This includes:

Ternary Expressions (If-Then-Else)

Formula: condition ? valueIfTrue : valueIfFalse Another example:

Arithmetic

Function Calls

Available functions:
  • len(value) — Length of string or array
  • clamp(v, min, max) — Constrain number between min and max
  • now() — Current timestamp (milliseconds)
  • In(stateId) — True when the given state is currently active

String Concatenation

Undefined Variables: Default Behavior

What happens if you try to interpolate a variable that doesn’t exist or is uninitialized?
The variable is replaced with an empty string. The text still displays, but with nothing in place of the variable. To avoid this:
  • Always initialize variables with a default value
  • Use a ternary expression to provide fallback text:

Real-World Examples

Quiz Feedback

Personalized Status Message

Time-Based Messaging

Conditional Content

Where Interpolation Works

Interpolation is available in: Where it doesn’t work:
  • Variable names and values (you can’t use interpolation in the Variable Inspector itself)
  • Condition expressions (use variables directly, not interpolated)

Testing Interpolation

When you preview your training:
Set variable values manually in the Variable Inspector preview to see how interpolation changes the text. For example:
  1. Set userName = "Alice"
  2. Preview the state
  3. See text like “Hello Alice, welcome!”
  4. Change userName = "Bob"
  5. See text update to “Hello Bob, welcome!”

Best Practices

Avoid overly complex expressions in {{ }}. If it’s hard to read, it’s hard to maintain. Consider breaking complex logic into separate variables.
Set default values so interpolated text doesn’t show blanks. userName = "" is better than undefined.
Instead of creating separate panels for different text, use {{condition ? text1 : text2}} to keep one panel that changes.
If you use userName in some places and learnerName elsewhere, you’ll confuse yourself. Pick a naming convention and stick with it.
Preview your training with actual variable values to make sure the interpolated text looks good and reads naturally.
Even if score = 92, consider displaying “Great job!” instead of just the number. Use ternary expressions to show friendly feedback.

Common Mistakes

Forgetting quotes in expressions: If you use a string value in a ternary, add quotes: {{actualValue == 'correct' ? 'You got it!' : 'Try again'}}
Leaving uninitialized variables: If you interpolate a variable you forgot to create, it displays as blank. Always create and initialize variables first.
Using interpolation in conditions: Conditions use variables directly, not interpolation. Use score >= 80, not {{score}} >= 80.

Next Steps

Learn more about: