10-18-2023, 03:58 PM
(This post was last modified: 10-18-2023, 03:59 PM by Kernelpanic.)
Quote:@bplus - 5) Arrays should be hard indexed. Don't DIM SHARED Array(10); instead DIM SHARED Array(0 To 10). This prevents incompatibility if the user has OPTION BASE 1 in effect.Wether that makes sense? If you declare an array with A( 0 To 10) you have eleven array elements, despite OptionBase 1.
To prevent this you have to fill the array with 1 to 10. With it a declaration with A(0 To 10) has no practical use.
Code: (Select All)
'18. Okt. 2023
Option _Explicit
Option Base 1
Dim As Integer feld(0 To 10)
Dim As Integer feld2(0 To 10)
Dim As Integer feld3(10)
Dim As Integer a, b, c, d
Locate 3, 3
For a = 0 To 10
feld(a) = a
Print Using "## "; feld(a),
Next
Locate 5, 3
For b = 1 To 10
feld2(b) = b
Print Using "## "; feld2(b),
Next
Locate 7, 3
For c = 1 To 10
feld3(c) = c
Print Using "## "; feld3(c),
Next
'Error - Out of range.
Locate 9, 3
For d = 0 To 10
feld3(d) = d
Print Using "## "; feld3(d),
Next
End