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


The code service contains all the actions written by the user.


An action takes inputs, runs code and returns outputs.
Actions are similar to functions in mathematics. Consider the function that computes the square of x: square(x) = x*x. In code, it would look like this:
x : Number)
returns (
result : Number)
result := x * x
end function

private action

An action can be marked as private in the properties. A private action...
  • cannot be run directly.
  • is not visible outside a library (if the script is a library).
private function
always fails...
time → fail if not(false)
✎ 'fail if not' is obsolete and should not be used
end function

test action

An action can be marked as test in the properties. When a script contains tests, a button to run all tests at once is automatically visible.
test function
contract → assert(2 + 2 = 4, "this assertion should never be false")
end function

extracting code

There is an easy way to create action from existing code: select the statements to extract (use mark), then simply tap on extract.

inline actions

Actions are sometimes defined inside other actions (learn more).

atomic actions and async keyword

Actions can be marked with the atomic keyword to state that they will not wait for input from an external source (learn more).

extension actions

Actions that take a record as first argument can be invoked as instance members (learn more).


The comment(s) at the beginning of an action are used to provide a description of its function. This text will show in the help area when the action is called from the code editor. This is particularly useful for libraries.
There is a special macro for reference documentation. For example, {hints:foo:bar,baz} declares that "bar" and "baz" are valid values for the parameter named foo. They will be suggested to the user calling the action.