loop %var:EXPR% in %source:EXPR% — Blocks

loop %var:EXPR% in %source:EXPR%
Control Flow1.0.0

Description

Iterates over each element from a registered loop source.

Allowed Contexts

Root LevelInside Block

Block Variables

var
string
NullableNo

The current element from the loop source, named by the user (e.g. 'p' in 'loop p in all players'). The type depends on the loop source; for example, 'all players' produces Player-typed elements.

Examples

loop p in all players: message p "Hello!"

All Possible Usages (1)

Every distinct way you can write this pattern, with optional groups and choice groups expanded. Placeholders are shown as <name>.

loop <var> in <source>

Related (Control Flow)