Search code examples
mit-scratch

In Scratch how do you determine in the IDE if a variable is "For all sprites" or not AFTER the variable has already been created?


I know that when you are creating a variable in Scratch by pressing "Make a variable" button, you then get a dialogue box where you can select the scope of the variable with the radio buttons for either "For all sprites" or "For this sprite only".

However, after the variable has been created how can I look at my code to determine which scope was used?

At the moment, because I don't know the answer to this question. I keep deleting my variables and recreating them in the IDE to make sure the scope is what was required. This has the side effect of deleting all code that references those variables, which is obviously problematic.


Solution

  • Select "Stage" (bottom right of the project editor page, next to the list of sprites), then check if your variable is present in the list of available variables (left-hand side of the project editor page, tab "Code"). If it is there, then it is a "For all sprites" variable. If it is not, then it is a "For this sprite only" variable.