ForEach: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 46: | Line 46: | ||
[[Category:Statements - Flow of control]] | [[Category:Statements - Flow of control]] | ||
[[Category:BASIC Functions]] | |||
Revision as of 15:25, 25 March 2019
ForEach(array, function)
Description
ForEach calls function on each element of array.
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