Part of the standard trait_keyedForEach. Iterates over each "key", which is simply the positions for each element.
array->foreachkey => { expression }
This example returns a list of the squares of the keys (element positions) of an array.
Code
define squareMe(n::integer) => {
return #n * #n
}
var( myNames = array('Tom' , 'Jen' , 'Cam' ))
$myNames->foreachkey => {^ squareMe(#1)+' ' ^}
Result
1 4 9
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments