Use variables to remember information—such as a learner's name or a numeric value—then display dynamic content based on that information (see Adding Variable References). Variables are also a great way to add conditional interactivity to courses (see Adding Triggers). And the good news is you don't have to know anything about coding!

In this tutorial, we'll cover:

 Adding Variables

Adding variables in Articulate Storyline is super easy.

  1. Click Manage project variables in the Triggers panel.
  2. When the Variables window opens, click Create a new variable (looks like a plus sign) in the lower left corner.
  3. Give your variable a recognizable Name, so it's easy to identify later.
  4. Choose the Type of variable you want to create. Storyline supports three types:
    • True/False variables are often referred to as Boolean variables. They're either true or false. They're great for creating toggle buttons and restricting learners' options. For example, you might use a true/false variable to track whether a certain event has occurred, then let learners proceed to the next slide only when the variable is true.
    • Text variables hold text values. Common uses include personalizing content by displaying the learner's name throughout a course and evaluating text-based interactions.
    • Number variables hold numeric values. Common uses for number variables include tracking the number of times a particular event has occurred and performing mathematical calculations.
  5. Enter a default Value. (The default value for text variables can be blank.) 
  6. Click OK to save your new variable.
  7. Click OK again to close the Variables window.

Tip: Storyline automatically creates variables for you in the following cases:

  • When you add a result slide, four number variables will be added for scoring purposes.
  • When you add a slider, a number variable will be added to track the slider value.
  • When you add a text-entry field, a text variable will be added to track learners' input.
  • When you add a numeric-entry field, a number variable will be added to track learners' input.

 Using Triggers to Adjust Variable Values

Need to change the value of a variable during a course? It's as easy as adding an Adjust variable trigger. See this tutorial to learn more about triggers.

 Evaluating Variables to Trigger Conditional Actions

You can use variables to make triggers conditional. See this tutorial to learn how to add conditions to triggers.

For example, let's say you want to change the state of an object when a true/false variable is true. It'd look something like this:

 Referencing Variable Values in Slide Text

Variables store data. Triggers let you adjust the data. And variable references let you display the data anywhere in your course, making your content dynamic and interactive. For example, you might ask learners to enter their names on the first slide. You store that information in a variable. Then you use variable references to personalize the rest of the course with their names.

In another example, you might ask learners to enter their weight and height. You store both values in variables. You use triggers to calculate their body mass index based on those variables. Then you use variable references to display the results.

Variable references can be added to any text-based object, including text boxes, captions, shapes, and buttons. See this tutorial to learn more about variable references.

 Editing Variables

To edit a variable in your project:

  1. Click Manage project variables in the Triggers panel.
  2. Select the variable you want to edit and click the Edit icon (looks like pencil) in the lower left corner.
  3. Rename the variable and/or change its default value. (You can't change its type.)
  4. Click OK twice to save your changes.

You can also rename variables and change their default values just by clicking in the grid.

Tip: When you rename variables, all references to those variables in your slide text and triggers will be updated automatically.

 Deleting Variables

To delete a variable from your project:

  1. Click Manage project variables in the Triggers panel.
  2. Select the variable you want to delete and click the Delete icon (looks like a trash can) in the lower left corner. (You can also press the Delete key on your keyboard.).

Tip: When you delete a variable, any references to that variable in your slide text will remain. You'll need to edit or delete those references manually. Triggers that involve deleted variables will also remain, but they'll become "unassigned." You can either edit or delete those triggers.

 Finding Variables

If you use variables extensively, it can be difficult to remember where they're referenced throughout your course. No problem. Storyline has you covered.

  1. Click Manage project variables in the Triggers panel.
  2. Click the hyperlinked number in the Use Count column for the variable you want to find.

Storyline will display all references to that variable in a separate window.

 Translating Variables

Storyline has built-in translation features to help you localize content in different languages. However, it's important to note that the translation features let you translate default values for your variables and variable references in your slide text, but not the variable names. If you translate the variable references in your slide text, you'll also need to manually translate the variable names in your project. Otherwise, variable references in your slide text won't work.

 A Note About Variables and States

Both variables and states track information and add interactivity, but they differ in scope and behavior. States control visual elements for a single slide, while variables control elements across slides, scenes, or even an entire project. Here are some examples of when you'd use variables and states.

Use variables when you want to: Use states when you want to:
  • Remember values entered by the learner
  • Count the number of times a button is clicked
  • Perform mathematical calculations
  • Trigger actions based on learner input
  • Remember which objects have been clicked
  • Change how objects look based on learner interaction
  • Trigger actions based on learner interaction