Logic and flow control
The conditional, jump, wait and exit blocks in Aimogen Pro OmniBlocks, and how to build branching and looping workflows.
Four block types turn a linear list into a program.
Conditional (IF)#
if_block evaluates a condition and controls what happens next.
Typical conditions:
- A placeholder is empty or non-empty
- A placeholder contains a string
- A numeric comparison
- A regular expression match
Uses:
Skip expensive work when it is not needed.
1. crawl_sites scrape the source URL
2. if_block if %%scraped_content_plain_1%% is empty -> exit
3. ai_text write the article (only reached when there is content)
4. save_post publishBranch on classification.
1. ai_text "Classify this enquiry as SALES, SUPPORT or OTHER: %%ai_chatbot_full_input_0%%"
2. if_block if %%ai_text_1%% contains SALES -> jump to 5
3. if_block if %%ai_text_1%% contains SUPPORT -> jump to 8
4. jump_block -> 11
5. ... sales branchJump#
jump_block moves execution to a specific block identifier.
Forward jumps skip blocks — the branching pattern above.
Backward jumps create loops.
For iterating over a list, ai_text_foreach is safer than a jump loop: it runs once per input line and
terminates on its own.
Wait#
wait_block pauses for a set time.
Uses:
- Waiting for an asynchronous provider — Midjourney generations are not instant
- Staying inside a rate limit between calls
- Spacing social posts so they do not all appear in the same second
Exit#
exit_block ends the workflow immediately. Later blocks do not run.
Use it as the "nothing to do" path from a conditional — no source content, a duplicate detected, a classification you do not act on.
The critical flag#
Every block, not just logic blocks, has a Critical flag.
| Critical | On failure |
|---|---|
| Yes | The workflow stops |
| No | The block is skipped and execution continues with an empty placeholder |
This is your main error-handling tool. Mark blocks whose output is essential as critical; mark optional enrichment as non-critical.
Patterns#
Guard clause. Put an if_block and exit_block immediately after any block that might return
nothing. Everything downstream can then assume it has data.
Fan-in. Several optional enrichment blocks marked non-critical, then one AI block that uses whichever of them produced output. Missing placeholders resolve to empty strings.
Classify then branch. A cheap model classifies, if_block branches, each branch uses an appropriate
model. Far cheaper than sending everything to an expensive model.
Limitations#
There is no else. Build the negative path as a separate if_block with the inverse condition, or as the
fall-through after a jump.
There is no counter variable. Use ai_text_foreach when you need iteration with an index.
If a workflow needs more logic than this comfortably expresses, consider an
AI Agent — agents decide their own sequence — or a
PHP snippet called from a diy block.
Related#
Still stuck? Open a support ticket and include the diagnostics from Aimogen Pro › System & Logs › System Info.