Comment on page
Control Flow Bricks
There are 4 primary control flow bricks: If-Else, For-Each, Try-Except, and Retry:
- If-Else: if a condition is met, run one the “if” branch of bricks, otherwise run the “else” branch of bricks
- Try-Except: run a “try” branch of bricks, recovering by running the “catch” branch of bricks if there’s an error or the user cancelled the run
- Retry: run a body of bricks, and re-run the body if there’s an error
- For-Each: for each element in a list/array, run a body of bricks, providing a different element to the body for each run
The Document Builder also uses control flow for the Button element handler, and the Brick element. The information on this page also applies to bricks you add to those elements.
📖 When a Control Flow brick has multiple sub-sequences of bricks, we will call them “branches”. When a Control Flow brick contains a single sequence of bricks, we will call it the “body”.
In the Mod Overview, the Control Flow brick appears as a brick with a top/bottom section and one or more branches of bricks:
The If-Else brick. If the condition is true, PixieBrix will show confetti. If the condition is false, PixieBrix will show an alert.