forEach

Program construct for looping through a set of values.


Syntax

forEach is a set of objects only - no underlying function
input: array of any type
output: one element of the array at a time

Usage

Drop this set of objects down into your program wherever you need to serially process each member of an array.

Location

menu: veeos ==> Coding ==> forEach

library: none- objects only

Example

Notes

While this is functionally the same as the forEach native object introduced with VEE8, this rendition will work equally in any version of VEE and it provides an advtange in that the index is available for use.

In some cases it may well be desirable to create an index variable for use in other sections of the program. This allows you to know where in a given list you are currently indexed. One way to do this is with a setVar(), as in

or, if you would like to reduce the scope of the index variable, you can use a Declare Variable first, as in

Reference

Dependencies

Supported On

VEE 7.0+, all platforms

See Also


© 2015-2025. All Rights Reserved. Stan Bischof (stan@worldbadminton.com). Last updated 03 February 2023 13:03.