in — separate loop name and iterable

Syntax and values

Behavior and details

In a for loop, in separates the name for the current item from the List or Text you want to visit. That collection is sometimes called an iterable: something a loop can go through item by item. An iteration is one round of the loop.

Pliro works out the collection once before the loop starts. Each round gets a fresh local name for its current item. in is not a separate “does this collection contain this value?” operator; 2 in items is unsupported. Use a loop and equality checks to search a list.

Example

# language: en
for item in [1, 2, 3]:
    say item

Syntax and values · Built-ins · Programming guides