Skip to content
iPlugin

Execution flow

Learn how Kether executes actions in order, blocks and conditional branches

1. Sequential execution: top to bottom

Actions in the same block execute one after another, from top to bottom.

tell "Step one"
tell "Step two"
tell "Step three"

The messages appear in order: “Step one”, then “Step two”, then “Step three”.

Think of preparing a meal: wash the ingredients, chop them, then cook them. The order matters.

2. Group actions with { }

Use a pair of braces, { }, to group actions that should execute together:

{
  tell "First action"
  tell "Second action"
}

The block acts as a unit. Its actions execute in order before execution continues outside the block.

3. Conditions

Kether supports “if…otherwise…” logic:

if CONDITION then {
  ACTIONS_WHEN_TRUE
} else {
  ACTIONS_WHEN_FALSE
}

For example:

if check money >= 100 then {
  tell "You have enough money"
} else {
  tell "Not enough money"
}

Execution proceeds as follows:

  1. Evaluate check money >= 100 to get true or false.
  2. If true, execute the actions inside { } after then.
  3. If false, execute the actions inside { } after else.

Wrap the actions after then and else in { }, even when a branch contains only one line.

4. Nesting: blocks inside blocks

A block can contain another if and another pair of { }:

if check money >= 100 then {
  if check level >= 10 then {
    tell "You have enough money and a high enough level"
  } else {
    tell "You have enough money, but your level is too low"
  }
} else {
  tell "Not enough money"
}

The outer condition determines which branch to enter. If that branch contains another if, its condition is evaluated in the same way.

5. Summary

ConceptMeaning
SequenceExecute actions in the same block from top to bottom
Block { }Group actions into a single unit
if then elseTake the then branch when true, otherwise take else
NestingPlace blocks and conditions inside other blocks

Remember: actions run top to bottom, conditions select a path, and blocks group actions.