Control Flow
Control flow in Ragul is expressed entirely through suffixes and named scopes — no reserved keywords. The same scope-as-suffix unification that makes functions work also makes conditionals and loops composable and reusable.
Conditionals
A conditional is a named scope suffixed with -ha / -if (if / given that).
Simple if
If / else
-hanem / -else is the else branch — a sibling block at the same indent level as its -ha / -if:
If / else-if / else chain
-különben-ha / -elif extends the chain. Each link carries its own condition inline:
Calling a conditional scope as a suffix
Exactly like any other named scope:
Conditional suffix reference
| Hungarian | English | Meaning |
|---|---|---|
-ha |
-if |
if / given that — opens a conditional scope or branch |
-hanem |
-else |
else — sibling branch when -ha / -if condition fails |
-különben-ha |
-elif |
else-if — chained conditional branch |
Loops
Loops are named scopes suffixed with a repetition marker. The condition that controls the loop is provided by a -ha / -if root in the same sentence.
While loop — -míg / -while
Repeats the scope while the condition holds:
Until loop — -ig / -until
Repeats until the condition becomes true:
For-each — -mindegyik / -each
Applies a scope to every element of a collection:
Accumulate / fold — -gyűjt / -fold
Folds a collection into a single value. The accumulator is supplied via -val / -with:
Early exit — -megszakít / -break
-megszakít / -break terminates a loop immediately. It always composes with -ha / -if so the exit is conditional:
Loop suffix reference
| Hungarian | English | Meaning |
|---|---|---|
-míg |
-while |
Repeat while condition holds |
-ig |
-until |
Repeat until condition becomes true |
-mindegyik |
-each / -every |
Apply to each element of a collection |
-gyűjt |
-fold / -reduce |
Accumulate a result across a collection |
-megszakít |
-break |
Early exit — terminates the current loop |
The Functional Character of Ragul
Ragul's control structures are deeply functional by design:
- Suffix chains are function composition
- Scopes are closures
- Named conditionals and loops are reusable transformations, not imperative control flow
A conditional defined once becomes a suffix reusable anywhere. A loop body defined once can be mapped over any collection. The same mechanisms that define functions define control structures — there is no separate syntax.