Variables are numbers that you can set, and then access later on in your project. For example if you are making a game, you may want to keep track of the score. To do this, you create a new variable called
To display your variable, you can use the Set Text to Score block. Here’s a tip: put the block in a
Repeat Forever block so that the text object always displays the score.
If you want to set your variable to a number, (for example, you might want someone to start with 100
Coins in a game) use the
If you want to increase your variable (for example when a player scores a point), use the
Increase block. You can increase the variable by whatever value you like, and also decrease it by using negative numbers.
You can access your variables in any block that takes a number by scrolling left on the keyboard, until you see the variables. Tap on a variable to add it to your code.
If you have any other questions, just tag me @MR.GAM3R. Hope this helps!