As a reminder, variables are a way to store small pieces of information so we can use them later.
The Set State function allows you to set or change the information stored in your variables.
How To Use Set State
On the Data tab of any block, click the Set State icon at the bottom to add a Set State block. You can add as many Set State blocks as you need.
First, select the variable you wish to set or update using the variable dropdown.
You can then set your variable to numeric values like 1 or 25.
You can also set your variable to text values as well like "blue" or "Why did the chicken cross the road?". Just enter the text... don't enter the quotes.
You can use the expression builder of the Set State function to create more advanced calculations.
Here, we'll increase the playersScore value by 5. We do this by setting the playerScore variable to the expression playerScore + 5.
The result of the expression can also be true or false. In this example, we'll set the isLastQuestion to questionNumber = 10. This will set the isLastQuestion variable to true when questionNumber is equal to 10 and to false otherwise.