Changes between Version 3 and Version 4 of Doc/panc/dml/flow
- Timestamp:
- Jun 15, 2007, 8:41:09 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Doc/panc/dml/flow
v3 v4 33 33 The 'foreach' statement allows iteration over all of the elements of a list or hash. The syntax is: 34 34 {{{ 35 foreach (key , value,resource) body-dml;35 foreach (key; value; resource) body-dml; 36 36 }}} 37 37 This will cause the body-dml to be executed once for each element in resource (a list or hash). The local variables 'key' and 'value' (you can choose these names) will be set at each iteration to the key and value of the element. For a list, the key is the element's index. The iteration will always occur in the natural order of the resource: ordinal order for lists and lexical order of the keys for hashes.