cArray: ForEach

ForEach

Iterates over an array passing in each element into an Action function to be performed on the element.



 Public Sub ForEach(
	  ByRef Arr As Variant,
	  ByVal AddressOfAction As Long )

Parameters

Arr
[ByRef] Variant. The array containing the elements to be processed.
AddressOfAction
[ByVal] Long. The callback address of the function to process an array element.

Remarks

The callback method must be a Sub with a single ByRef parameter of the same type as the array.

 Public Sub ActionMethod(ByRef e As [Data Type])
     ' Perform action on e.
 End Sub
 
The [Array Datatype] must be replaced with the datatype of the array. If the array is an array of Variants, then the [Array Datatype] would be a Variant, not any specific sub-type within the variants of the array.

See Also

Project VBCorLib Overview Class cArray Overview cArray Properties cArray Methods FindLastIndex GetLength