ForEach: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 3: | Line 3: | ||
== Description == | == Description == | ||
ForEach calls a function on each member of | ForEach calls a ''function'' on each member of ''object''. ''Object'' can be an array, collection, object, class or control. | ||
== Example (Basic) == | == Example (Basic) == | ||
Revision as of 18:31, 3 October 2014
ForEach(object, function)
Description
ForEach calls a function on each member of object. Object can be an array, collection, object, class or control.
Example (Basic)
Rem ForEach Example
Dim School
School = Array("Principal", "Mr. Garrison", "Chef")
ForEach(School, listItem)
Function listItem(item)
Print item
Next
Example (JavaScript)
// ForEach Example
var School;
School = new Array("Principal", "Mr. Garrison", "Chef");
School.forEach(listItem)
function listItem(item){
NSB.Print(item);
}
Output
Principal Mr. Garrison Chef