ForEach: Difference between revisions
Jump to navigation
Jump to search
Created page with "ForEach(''object'', ''function'' == Description == ForEach calls a function on each member of an objects. Object can be arrays, collections, objects, classes or controls...." |
|||
| Line 41: | Line 41: | ||
== Related Items == | == Related Items == | ||
[[do...loop|Do...Loop]], [[exit|Exit]], [[for...next|For...Next]], [[while...wend|While...Wend]] | [[do...loop|Do...Loop]], [[exit|Exit]], [[for...next|For...Next]], [[while...wend|While...Wend]], [[For Each...Next]] | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Statements - Flow of control]] | [[Category:Statements - Flow of control]] | ||
Revision as of 18:28, 3 October 2014
ForEach(object, function
Description
ForEach calls a function on each member of an objects. Object can be arrays, collections, objects, classes or controls.
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