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


if

if is a statement that allows to run different code based on a boolean value.
if condition then
This code runs if `condition` is `true`.
else
This code runs if `condition` is `false`.
end if

do I need else?

You can leave the then or else blocks empty as needed.
if condition then
This runs if `condition` is `true`. We leave `else` empty.
else ... end if

chaining ifs

You can chain sequences of if statement by adding the else if statement in the else block.
if condition then
...
else if other condition then
`other condition` is `true`.
else
Neither`condition` nor `other condition` are `true`.
end if

drag and drop

You can drag and drop an entire if statement by grabbing the keyword.

see also