ForEach

From NSB App Studio
Revision as of 17:55, 22 July 2019 by Ghenne (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ForEach(array, function)

Description

ForEach calls function on each element of array.

Example

<pre>
// ForEach Example

var School;
School = new Array("Principal", "Mr. Garrison", "Chef");
School.forEach(listItem)

function listItem(item){
  NSB.Print(item);
}

Rem ForEach Example
Dim School
School = Array("Principal", "Mr. Garrison", "Chef")
ForEach(School, listItem)

Function listItem(item)
  Print item
Next

Output

Principal
Mr. Garrison
Chef

Related Items

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