You are here


variable panel

A variable is a container that holds information. A variable has three properties: its name, type and value. The type cannot be changed after the variable is created, but the name and value being stored can change. For example, you might create a variable named SCORE, of type number that has an initial value of 0. Every time a certain action is performed, such as a correct response to a question, the SCORE can be incremented by a value of, say, 1. Then at some point, such as the completion of an exercise, the SCORE variable can be retrieved and displayed on the page.

There are three variable types: number, text and true/false.

Local vs Global
The difference between a Local and a Global variable is that a Local variable is only available on that one page.

So if you're doing some calculations and are displaying the information on that page, you can limit yourself to a Local variable.  If you only need them on that one page, then by using Local variables you also don't clutter up your variables panel with lots of variables that are not important (for example, if you have lots of variables on page 10, you don't have to see them on all your other pages).

Global variables are used when you need to carry information from one page to another, or if you need that value remembered when you leave the page and come back.  Examples of this might be an "exercise1Completed" variable or a "studentNameVar" that is recorded on one page, and then displayed on another.

Now that you know the difference, you can decide whether the variables need to be Global or Local.  If you wish to change an existing variable, simply click the globe icon on the variable, and that will toggle between them.

Where Used: To aid in your discovery of where these variables are being used, you can also select the variable (click in the empty space somewhere, or on the type [e.g., T/F, Num, Text]), and you can use the right-most icon to highlight any actions that are using that variable (on that page).  See this video:

Note that the Value displayed with Variable will be the initial value of the variable when the lesson is launched.  The default initial values are 0 for numbers, false for True/False, and blank for Text variables.  However, if you have a count down from 10 points, you might change the initial value to 10.  This can be useful if you plan to change the value later, or for debugging and testing purposes.

To learn how to create a variable, click here.