Goodies‎ > ‎

Foreach

A foreach block allows you to do something for each element of a list. Below are the blocks for a simple app in which it's used to turn a list of strings into a single string that's displayed in a label.  You can use a similar pattern blocks to convert a list of latitude/longitude coordinates into a string that you can use in a URL for the Google maps API. 



This code is in the attached ForEachGoody app. Here's a screenshot of the ForeachGoody app in action. The items "milk", "eggs", and "bread" have been added via Add Item and then Show all Items is pressed: 




ċ
ForeachGoody.zip
(3k)
Lyng Turbak,
Oct 26, 2011, 9:25 AM
Comments