Cold Help System: Programming: ColdC Reference Manual: Language Structure: Expressions: Looping Expressions: map


The map expression loops a variable through a list, dictionary or integer range, evaluating an expression for each iteration. Results from each iteration are collected into a list and returned when the loop is completed. The syntax for map can be either of the following:

map var in (what expr) to (iteration expr)
map var in [lower expr .. upper expr] to (iteration expr)

Examples:

map x in ([1, 2, 3]) to (tostr(x))
=> ["1", "2", "3"]
map x in [5 .. 15] to (x)
=> [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]


map | hash | find | filter


the Cold Dark