function functionName(__value) {}


Apply a function to each element of a collection (or other iterable variable). Returns an iterable containing the values returned by the applied function. 

The function argument should be a function accepting a single argument.

When the argument to map is an OBJECT, the mapping function will be passed an OBJECT with a single key-value pair.  


use System, String;

// Prints 5, 4, 3, 2, 1

// Flips the values in the list
function flip(item) {
    return 6 - item;

// Prints an iterator
function print(items) {
    var list = [];
    foreach(item in items) {
        list[] = item;
    System.print(String.join(list, ", "));