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


var

A local variable is a symbol that represents a value. One can read or write to a local variable.

declaration

A new local variable is defined by using the assignment := operator. In the editor, you can either tap on var or the extract to var intellibutton. The keyword var is automatically added.
var x := 0

reading

Simply use the variable in your code to use its value.
x → post to wall

update

Use the assignment := operator to save a new value in the variable.
x := 2

scope

A local variable exists within its definition scope. If the variable is defined in an action, it is available in that entire action. This is the case for x in this example.
However, if a variable is defined within a nested block of code, like a if, then it only exits within that block.
if false then
`y` only exists within the `else` block
var y := 1
else
`y` does not exist here
end if