if <condition> then <ifCommand> [else <elseCommand>]
if <condition> then
end if
if <condition>
then <ifCommand>

if a > 5 then
  add 10 to a
else if a < 0 then
  subtract 10 from a
  multiply a by 100
end if

if a ≠ 500 then
  if b > 100 then
    output "Not 500 and big!" & newline
  end if
end if

if myGreeting ends with "Sarah"
then output "Oh you mean me, Sara?"


The if command lets you react to the result of an expression, or do something else if it doesn’t match.

You can have multiple commands after a then or else by starting a new line for each command. These commands will end at the next else, or end if.

You can nest a second if inside another if as its ifCommand or elseCommand. In that case it will count as a single command even though it spans multiple lines.



The condition to evaluate. If this condition is true, ifCommands will be run, otherwise elseCommands.


The commands to execute when condition is true.


The commands to execute when condition is false.