Name

foreach — Process the content of a map

Synopsis

map foreach ( any KEY ,
  any VALUE ,
  map MAP ,
  any EXPR );
 

Parameters

any KEY

any VALUE

map MAP

any EXPR

Return

map

Description

For each key:value pair of the map MAP the expression EXPR is executed in a new block, where the variables KEY is bound to the key and VALUE is bound to the value. The return value of the last execution of exp is the value of the foreach construct.

Usage

  foreach (integer k, integer v, $[1:1,2:4,3:9], { y2debug("v = %1", v); return v; }) -> 9