Touch Develop retirement postponed until June 22, 2019. Sign-in and access to cloud assets to be removed on May 23, 2018.Learn More..


data

The data service contains the global variables of the script. Unlike local variables, global variables are accessible in all actions.
  • This example shows a global variable holding a counter:
data counter : Number
When referenced in the code, the word data is shortened to a symbol .

initialization

All global variables are initialized to invalid except for string and number.
 counter := 0
 sprite := invalid → sprite

reading and updating

You can read and update a global variable similarly to local variables.
 counter → post to wall
 counter :=  counter + 1

lifetime

You can arrange for global variables to be saved when the script stops and restored when the script starts again later. Learn more...