2021-04-28 16:49:39 +02:00
|
|
|
The use of ``++Option Base++`` to change the lower bound of an array's index values results in confusing code.
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2021-04-28 16:49:39 +02:00
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
Option Explicit
|
|
|
|
Option Base 1
|
|
|
|
|
|
|
|
'...
|
|
|
|
Dim MyArray(1 To 3) As Integer
|
|
|
|
For I = 1 To 3
|
|
|
|
MsgBox MyArray(I)
|
|
|
|
Next I
|
|
|
|
----
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2021-04-28 16:49:39 +02:00
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
Option Explicit
|
|
|
|
|
|
|
|
'...
|
|
|
|
Dim MyArray(0 To 2) As Integer
|
|
|
|
For I = 0 To 2
|
|
|
|
MsgBox MyArray(I)
|
|
|
|
Next I
|
|
|
|
----
|
2021-04-28 18:08:03 +02:00
|
|
|
|
|
|
|
|
2021-06-02 20:44:38 +02:00
|
|
|
|
|
|
|
ifdef::rspecator-view[]
|
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::comments-and-links.adoc[]
|
|
|
|
endif::rspecator-view[]
|