Want to build better elearning experiences? Want to add game mechanics like achievements, levels, and points to your courses? If so, now’s the time to learn about variables and how they help build better elearning.
At a recent workshop on variables, I asked one attendee what she learned. She said, “I learned not to use variables.” While this produced a chuckle, she was speaking some truth for the beginner who’s never used variables: at first they may seem a bit confusing.
This makes sense if you haven’t used them before and don’t have a programming background. On the surface they can seem complex. But in reality they’re not. It’s just a matter of knowing the terms and gaining an understanding of how they work. And then practice, practice, practice.
Today we’ll start the process of simplifying variables.
What is a Variable?
As I mentioned in a previous post, I learned to think of variables as an empty bucket. The bucket collects things. Once I have something collected, I can use it.
We use variables in elearning to collect values that we can use throughout the course. The values may be things like the user’s name, what they’ve clicked, their achievement, or an adaptive learning path. In either case, it’s a way to collect information that is used elsewhere in the course.
Types of Variables
Generally, there are three types of variables:
- Numbers: used for counting actions or doing calculations
- Text: input names or display text
- True/False: often used to track progress or if items are selected or not
Variables are used for all sorts of things and often the type of variable is interchangeable. The thing to remember is that the value is key and what type of variable you use to hold that value is not as important.
A good example is the True/False variable. Instead of T/F you could use numbers like 1 or 2, or even the text “true” or “false.” As you can see, they’re interchangeable. Of course, there are times when one type makes more sense than another.
Common Uses of Variables
Before we get into the details, let’s look at two common uses of variables: user names and counting clicks.
Variable: Add Your Name
It’s a good thing to personalize the learning experience. One way to do this is by collecting the user’s name and using it throughout the course. In the example below, you enter your name on one screen and see it displayed on another.
Variable: Track Onscreen Actions
Another common use is to track onscreen actions. In the example below you can click any choice but only two are correct. We track your correct and incorrect choices by counting clicks. If you click on a third wrong choice, you get some feedback.
The examples above are simple but common to many courses. Now let’s look at variables in a bit more detail.
How to Use Variables
Working with variables is a three-step process: 1) create, 2) adjust value, and 3) use value.
- Create variable. The first step is to create a variable. You’ll need to select the type, give it a name, and then determine a starting value (if any).
- Adjust value: The second step is to adjust the value of the variable. Generally, the user does something onscreen that triggers a change to the value of the variable. In the example below, we increase the Incorrect variable every time the user clicks on the wrong person.
- Use value: The third step is to use the value of the variable to do something. The value of the variable determines an action. For example, since we can track wrong selections by counting clicks, we can use the value we collect to trigger some feedback. In the example below, after selecting the incorrect choice three times we provide remedial feedback.
So that’s the essence of working with variables. You create them, an action changes their value, and then you can use that value to do something else in the course, whether that’s providing feedback or displaying a user’s name. Your only limit is your creativity.
Your Mission to Learn More about Variables
Years ago when I first started to learn to work with variables, the light didn’t come on until I actually knew what I wanted to do and then had to think through how to do it using variables. So to help you out, I’m assigning three common activities that will give you an opportunity to practice using variables.
- Collect the user name and display it on a different screen.
- Control course navigation using variables.
- Track how many correct items a user selects during an activity.
To help you out, here are some recent articles in the elearning community:
- Mike Enders has great post on doing calculations with variables and then a more detailed series on creating a running calculation. This includes examples, video tutorials, and the source file. Great for a team practice activity.
- The community created a bunch of quick tutorials on how to use variables. These are worthy of bookmarking for future reference.
The key is to practice. And if you have any questions, don’t hesitate to jump in the community and ask. We’re always there to help.
Upcoming E-Learning Events
- August 3 & 4 (Seattle, WA). Connect with your peers in the Pacific Northwest and learn all sorts of tips & tricks in this fun community-based workshop. SOLD OUT.
- September 20-21 (Dallas, TX). Connect with your peers in Texas and learn all sorts of tips & tricks in this fun community-based workshop. Register here.
- October 12-13 (Vancouver, BC). Connect with your peers in British Columbia and learn all sorts of tips & tricks in this fun community-based workshop. Register here.
- November 1 & 2 (London). Articulate Roadshow. Details coming soon.
- November 4 (Dublin). Articulate E-Learning Workshop. Details coming soon.
Free E-Learning Resources
Want to learn more? Check out these articles and free resources in the community.
Here’s a great job board for elearning, instructional design, and training jobs
Participate in the weekly elearning challenges to sharpen your skills
Lots of cool elearning examples to check out and find inspiration.