// ForEach Example
var School;
School = new Array("Principal", "Mr. Garrison", "Chef");
School.forEach(listItem)
function listItem(item){
NSB.Print(item);
}
ForEach
Jump to navigation
Jump to search
ForEach(array, function)
Description
ForEach calls function on each element of array.
The BASIC implementation of this function is consistent with VBScript: element is a simple variable which gets the value of each element in the array sucessively.
If you're using JavaScript, the JavaScript specification is fully supported.
Example
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