![scratch codeing scratch codeing](https://d3i71xaburhd42.cloudfront.net/26e08cbcf9b7622cb5e2257b7b8bce9020853f95/4-Figure2-1.png)
If you select for all sprites, your variables become global, meaning that it can be changed or accessed from any sprite in your project, regardless of the on which sprite it was created. So, you’ve come to the crossroads: do you choose for all sprites, or do you choose and for your sprite only?įor all sprites or for this sprite only: the true dilemma. What is the difference between a global variable and a local variable?
![scratch codeing scratch codeing](https://cdn2.penguin.com.au/covers/original/9781593279769.jpg)
The option that you select will determine whether you’re making a global or a local variable. In our previous blog post, we talked briefly about how to create a variable, but we didn’t talk about one small detail: recall that, when you’re making a variable, you can choose to create it for all sprites or for your active sprite only. Numerical and alphanumeric variables: containers for Variables are like containers that can hold a number (numerical variables) or a word (alphanumerical variables): This ability makes variables incredibly useful! Being able to hold this bit of information allows us to reference and manipulate it at many different places in a program. This is a quick tutorial on what a variable is and how we use them in scratch! What is a variable?Īs a quick recap from a few blog posts ago, a variable is a container of sorts that can hold one piece of information at a time, like a word or a number. If you’ve been using Scratch for a while now, you may notice that there’s things called variables in Scratch.