From Test-Scratch-Wiki

2.0 () (variable).png
Category Variables
Type Reporter

The () block is a Variables block and a Reporter block. The block simply holds its variable.

Whenever a variable is created, a version of the block appears with the variable's given name on it — this results in a version of this block for every variable. Each version of the block holds its 'assigned' variable.

This block can be displayed as a Stage monitor.


Main article: List of Block Workarounds

A global variable can be accessed with

([global variable v] of [Stage v])

A private variable can be accessed with

([private variable v] of [Sprite v])

Example Uses

Variables could never be used if there were no blocks that held them — this is the block that holds all variables. Additionally, variables' Stage monitors can be used as a display for text — it is easier to use than to create sprites and program them to be a display.

The block can be used to:

  • Save information
ask [What's your name?] and wait
set [name v] to (answer)
  • Recall information
say (join [Hi, ] (join (name) [!]))
  • Display information
say (random speech)

No specific uses can be given for the () block, as it merely holds a variable. The only proper use is when the block has not been taken onto the scripting area, when you click on the little box to show the variable or hide it again. But this use has no scripting use, as there is already a Hide Variable block for scripting, so this use is probably only for testing games, interactive projects etc.

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.