ForEach

From NSB App Studio
Revision as of 18:27, 3 October 2014 by Ghenne (talk | contribs) (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....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Related Items

Do...Loop, Exit, For...Next, While...Wend