HomeManualTopicsTypesSymbols

std_types::binary_table/std::for_each

iterates over all items of the key order table

Parameters

self
the hash table to iterate over
body
the statement sequence to execute for each item
finally (default: next)
used to return results to the caller

Results

None

Description

For each item the statement sequence supplied as body is called with one or two arguments (depending on body's parameter count).

If called with two arguments the first argument is the key and the second argument the corresponding value.

If called with one argument then only the value is supplied.

This is a sequential loop.

Example

$ages empty_binary_table !ages("Tom") 5 !ages("Sam") 3 !ages("Sarah") 11 for_each ages: (name age) writeln! name ": " age next

Output

Sarah: 11 Sam: 3 Tom: 5

Implements

std::for_each iterates over all items of a collection