Variables are logical objects within a title that enable you to store, modify, and test values of numbers or strings during the runtime of a published title. You can conditionally perform actions in a title based on variable values and you can display variable values to the user.
There are many uses for variables, including branching to different sections of a title depending on user preferences and displaying information based on multiple user inputs. Variables enable you, as the title author, to capture what a user has done (such as click on a button) within the title and to conditionally act on that at a later time.
For example, suppose you want to give users three opportunities to answer a question correctly. You can create a question with a Check My Answer button. The user will click on the button to see if their answer is correct. Every time the user clicks on the button, you can increment the value of a Question_Count variable. The Question_Count variable is initially 0, and can modified to increase by a value of 1 every time the user clicks on the Check My Answer button. Finally, you can execute a conditional action that if the Question_Count is greater than or equal to 3, reveal the correct answer to the user.
See also:Answer and response variable value formats
© Copyright eLearning Brothers 2021