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


operators

assignment operator :=

The assignment operator is :=. It can be used to declare a new local variable or update the value of a variable.
  • declaring a new variable
var x := 0
  • updating a variable
x := 1
hint
Do not confuse the assignment := operator with the number equality = operator.

concat operator ||

The || operator takes two values of any type, converts them to a string and concatenates them together.
var s := "hello ""world"5

arithmetic operators

Arithmetic operators operate on numbers and return a number.
  • +: addition between 2 numbers
1 + 3
✎ '+' returns a 'Number'; did you want to use this value?
  • -: subtraction between 2 numbers
1 - 3
✎ '-' returns a 'Number'; did you want to use this value?
  • *: multiplication between 2 numbers
3 * 2
✎ '*' returns a 'Number'; did you want to use this value?
  • /: division between 2 numbers
1 / 3
✎ '/' returns a 'Number'; did you want to use this value?
  • modulo is available through the math service
math → mod(1, 3)
✎ 'mod' returns a 'Number'; did you want to use this value?

relational operators

Relational operators operate on numbers and return a boolean.
  • =: equality. Do not confuse it with the assignment operator.
3 = 4
✎ the '=' comparison has no effect here; did you mean assignment ':=' instead?
  • : inequality. Keyboard shortcut: !=.
34
✎ '≠' returns a 'Boolean'; did you want to use this value?
  • : less or equal than. Keyboard shortcut: <=.
34
✎ '≤' returns a 'Boolean'; did you want to use this value?
  • <: less than
3 < 4
✎ '<' returns a 'Boolean'; did you want to use this value?
  • : greater or equal than. Keyboard shortcut: >=
34
✎ '≥' returns a 'Boolean'; did you want to use this value?
  • >: greater than
3 > 4
✎ '>' returns a 'Boolean'; did you want to use this value?

boolean operators

Boolean operators operate on booleans and return a boolean.
  • not, logical negation
not true
✎ 'not' returns a 'Boolean'; did you want to use this value?
  • and, logical and, indicates if both values are true
true and false
✎ 'and' returns a 'Boolean'; did you want to use this value?
  • or, logical or, indicates if any value is false
true or false
✎ 'or' returns a 'Boolean'; did you want to use this value?