Loop Blocks
- 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
- PDF
Loop Blocks
- Updated on 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
- PDF
Article Summary
Looping over the same series of statements can useful for both visualization and to removing repetitive statements in a plan. That's where the Loop Block comes in.
Loop Blocks run the set of statements in the block while enumerating over a list. The List can be a variable, a function, or a literal expression.
For example, we can create a directory exists for each service in a variable called @ServiceNames
. This variable could be defined elsewhere in our plan, or externally as a configuration variable.
Visual Mode
Text Mode (OtterScript)
Looping and Numbers
With the built-in @Range
function, you can loop over numbers just as easily as you might with a c-style "for" loop.
Visual Mode
Text Mode (OtterScript)
Was this article helpful?