Custom Loop

LoopUtilities

Loop over a customized range of numbers.

Iteration Number is the absolute iteration number (1-based); Custom Iteration uses your provided values.
  • Loop block: the blocks placed inside it run once for each item, and can use the current item's outputs.

Inputs

Loop RangeRequired

Examples: 1-10 10-1 1,2,3,4,20-25

Example: 1,3-5,7

Loop Body

Blocks to run each iteration.

Holds blocks

Outputs

Iteration Number

Zero-based iteration index.

Example: 0

Custom Iteration

Value from your custom range.

Example: 5

Build a bot using blocks like Custom Loop

Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.

Advanced Documentation

This documentation can be useful when using code mode. View as Markdown

ID: advanced_custom_loop
  • Loop block: write for item := range advanced_custom_loop(Args{...}) { ... } and read the current item's outputs from item. See loops.

Inputs

FieldInventScript nameValue
Loop Rangeloop_rangee.g. "1,3-5,7"
Loop Bodybodyblocks: func() { ... }

Outputs

FieldInventScript nameValue
Iteration Numberiteration_numbere.g. "0"
Custom Iterationcustom_iteratione.g. "5"

Example InventScript

for range advanced_custom_loop(Args{loop_range: "1,3-5,7"}) {
	send_text_message(Args{channel_id: trigger.channel_id, message_content: "Next item"})
}

More utilities blocks