R – the best way to iterate through an array in Classic Asp VBScript

arraysasp-classicvbscript

In the code below

For i = LBound(arr) To UBound(arr)

What is the point in asking using LBound? Surely that is always 0.

Best Solution

Why not use For Each? That way you don't need to care what the LBound and UBound are.

Dim x, y, z
x = Array(1, 2, 3)

For Each y In x
    z = DoSomethingWith(y)
Next