<p>In the code below</p>

<pre><code>For i = LBound(arr) To UBound(arr)
</code></pre>

<p>What is the point in asking using <code>LBound</code>? Surely that is always 0.</p>

[{'answer_id': 2378, 'author': 'huseyint', 'author_id': 39, 'author_profile': 'https://Stackoverflow.com/users/39', 'pm_score': 2, 'selected': False, 'text': '<p>Probably it comes from VB6. Because with <a href="http://msdn.microsoft.com/en-us/library/aa266179(VS.60).aspx" rel="nofollow noreferrer">Option Base</a> statement in VB6, you can alter the lower bound of arrays like this:</p>\n\n<pre><code>Option Base 1\n</code></pre>\n\n<p>Also in VB6, you can alter the lower bound of a specific array like this:</p>\n\n<pre><code>Dim myArray(4 To 42) As String\n</code></pre>\n'}, {'answer_id': 2393, 'author': 'Chris Farmer', 'author_id': 404, 'author_profile': 'https://Stackoverflow.com/users/404', 'pm_score': 7, 'selected': True, 'text': "<p>Why not use <code>For Each</code>?  That way you don't need to care what the <code>LBound</code> and <code>UBound</code> are.</p>\n\n<pre><code>Dim x, y, z\nx = Array(1, 2, 3)\n\nFor Each y In x\n    z = DoSomethingWith(y)\nNext\n</code></pre>\n"}, {'answer_id': 8889, 'author': 'James Marshall', 'author_id': 1025, 'author_profile': 'https://Stackoverflow.com/users/1025', 'pm_score': 1, 'selected': False, 'text': "<p>I've always used For Each loop.</p>\n"}, {'answer_id': 121702, 'author': 'xpda', 'author_id': 14149, 'author_profile': 'https://Stackoverflow.com/users/14149', 'pm_score': 4, 'selected': False, 'text': "<p>There is a good reason <strong>NOT TO USE <code>For i = LBound(arr) To UBound(arr)</code></strong></p>\n<p><code>dim arr(10)</code> allocates eleven members of the array, 0 through 10 (assuming the VB6 default Option Base).</p>\n<p>Many VB6 programmers assume the array is one-based, and never use the allocated <code>arr(0)</code>. We can remove a potential source of bug by using <code>For i = 1 To UBound(arr)</code> or <code>For i = 0 To UBound(arr)</code>, because then it is clear whether <code>arr(0)</code> is being used.</p>\n<p><code>For each</code> makes a copy of each array element, rather than a pointer.</p>\n<p>This has two problems.</p>\n<ol>\n<li><p>When we try to assign a value to an array element, it doesn't reflect on original. This code assigns a value of 47 to the variable <code>i</code>, but does not affect the elements of <code>arr</code>.</p>\n <pre>arr = Array(3,4,8)\nfor each i in arr\n     i = 47\nnext i\nResponse.Write arr(0) '- returns 3, not 47</pre>\n</li>\n<li><p>We don't know the index of an array element in <code>for each</code>, and we are not guaranteed the sequence of elements (although it seems to be in order).</p>\n</li>\n</ol>\n"}, {'answer_id': 128898, 'author': 'AnthonyWJones', 'author_id': 17516, 'author_profile': 'https://Stackoverflow.com/users/17516', 'pm_score': 2, 'selected': False, 'text': "<p><code>LBound</code> may not always be 0.  </p>\n\n<p>Whilst it is not possible to create an array that has anything other than a 0 Lower bound in VBScript, it is still possible to retrieve an array of variants from a COM component which may have specified a different <code>LBound</code>.</p>\n\n<p>That said I've never come across one that has done anything like that.</p>\n"}, {'answer_id': 56822046, 'author': 'Javi', 'author_id': 8807803, 'author_profile': 'https://Stackoverflow.com/users/8807803', 'pm_score': 0, 'selected': False, 'text': '<p>This is my approach:</p>\n\n<pre><code>dim arrFormaA(15)\narrFormaA( 0 ) = "formaA_01.txt"\narrFormaA( 1 ) = "formaA_02.txt"\narrFormaA( 2 ) = "formaA_03.txt"\narrFormaA( 3 ) = "formaA_04.txt"\narrFormaA( 4 ) = "formaA_05.txt"\narrFormaA( 5 ) = "formaA_06.txt"\narrFormaA( 6 ) = "formaA_07.txt"\narrFormaA( 7 ) = "formaA_08.txt"\narrFormaA( 8 ) = "formaA_09.txt"\narrFormaA( 9 ) = "formaA_10.txt"\narrFormaA( 10 ) = "formaA_11.txt"\narrFormaA( 11 ) = "formaA_12.txt"\narrFormaA( 12 ) = "formaA_13.txt"\narrFormaA( 13 ) = "formaA_14.txt"\narrFormaA( 14 ) = "formaA_15.txt"\n\nWscript.echo(UBound(arrFormaA))\n\'\'displays "15"\n\nFor i = 0 To UBound(arrFormaA)-1\n    Wscript.echo(arrFormaA(i))\nNext\n</code></pre>\n\n<p>Hope it helps.</p>\n'}]
['https://Stackoverflow.com/questions/2348', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/193/']