Control Flow & Logic
Decision-making and iteration turn a linear list of blocks into a real program.
This tutorial shows how to:
- branch with if / else if / else
- repeat work with repeat, repeat while and for each
- pause or exit a flow with wait and return
- build conditions with the Logic operator palette
(Block basics are covered in earlier pages; only new behaviour is explained here.)
1 · The IF Block
1.1 Adding an IF
Drag Logic ▸ if from the Toolbox into the Script panel.
The block appears with:
- a Condition field
- one container zone labelled then
- a blue +else if link
- a blue +else link
1.2 Editing the Condition
- Click ✎ on the IF header.
- In the Condition field drag an operator—e.g. Logic ▸ == equals.
- Fill the left and right sides (numbers, variables or nested operators).
- Ok to exit Edit mode.
The IF now evaluates to true or false at run-time.
1.2 Editing the Condition
- Click ✎ on the IF header to enter Edit mode.
- Drag Logic ▸
== equalsinto the Condition field.- The operator block appears as a small capsule containing only the
==symbol (no header) and text inputs on either side.
- The operator block appears as a small capsule containing only the
- Drag values—numbers, variables, or even other operator blocks—into the left and right slots of the capsule. Just to see that it works, try 1 == 1.
- When the expression is complete, Click the
==symbol to reveal its ✔ Ok and 🚫 Cancel buttons. - Click ✔ Ok on the operator capsule, then Ok on the IF block to leave Edit mode.
The IF will now evaluate the expression and run its zones based on whether it resolves to true or false at run-time.
1.3 Adding Branches
- +else if inserts another conditional zone. You can add as many as you like.
- +else inserts a final fall-through zone (only one allowed).
Each zone is its own container—drop blocks inside in Drag mode.
1.4 Execution Order
At run-time:
- The IF evaluates the first Condition.
- The first zone whose condition is true executes; its blocks receive a blue outline.
- All following zones are skipped.
- If no condition is true and an else exists, that zone executes.
2 · Loop Blocks
2.1 repeat
Found under Flow ▸ repeat
- Field: Number of repetitions (numeric editor).
- The interior container executes exactly that many times.
2.2 repeat while
Found under Flow ▸ repeat while
- Field: Condition (same editor as IF).
- Iterates while the condition remains true.
- The condition is re-evaluated before every cycle.
2.3 for each
Found under Flow ▸ for each
- Field: List or dictionary (drop-down).
- Iterates once per element.
- For lists the current item value is exposed inside the loop (via the variable
item). - For dictionaries the current key is exposed (same variable name).
- For lists the current item value is exposed inside the loop (via the variable
2.4 Loop behaviour during execution
- The container’s outline turns blue on each iteration.
- Press ⏸ Pause to halt in the middle of a long loop; press it again to resume.
- There is no break or continue yet—run the full cycle or stop manually.
3 · Flow Utility Blocks
| Block | Purpose | Location |
|---|---|---|
| wait | Pauses execution for a specified number of seconds. | Flow ▸ wait |
| return | Stops execution of the current flow immediately. | Flow ▸ return |
Both are single-line blocks (non-containers).
return leaves any enclosing loops or IF zones without error.
4 · Logic Operator Palette
Operators live under Logic in the Toolbox.
They are blocks in their own right and can be nested inside conditions or parameter fields.
4.1 Comparison operators
== equals!= does not equal< less than> greater than<= less than or equal to>= greater than or equal to
4.2 Boolean literals & combinators
true,falseand,or,not
4.3 Building complex expressions
- Drag an outer operator (e.g.
and) into a Condition field. - Fill each side with further operators, variables or constants.
- Continue nesting until the expression matches your need.
There is no enforced depth limit; keep things readable by breaking work into multiple IFs where sensible.
5 · Quick Practice: FizzBuzz Lite
- Create a variable
nwith value1. - Add Flow ▸ repeat set to
10iterations. - Inside the loop place an if block.
- Build the condition
n % 2 == 0using== equalsand Math ▸ remainder (from the Toolbox). - In the then zone drop Message ▸ write to console and set text to
even. - After the IF, add Data ▸ increment and target
n. - ▶ Play — the console prints
evenfor numbers 2, 4, 6, 8, 10.
You have now combined loops, logic and data mutation.
6 · Recap
- if / else if / else let you branch.
- repeat, repeat while and for each provide iteration.
- wait and return control timing and early exit.
- The Logic palette supplies comparison and boolean operators that can be nested freely.