Returns a reference to an element in an array
Syntax
Declare Operator () ( lhs() As T, ByRef rhs As Integer, ... ) As T
Note that Operator () (Array index) returns a reference. As of 02.27.07, FreeBASIC syntax does not support returning references. When it does, this syntax will need to be changed.
Usage
result = lhs ( rhs [, ...] )
Parameters
lhs
An array.
rhs
An index of an element in the array.
T
Any data type.
Description
This operator returns a reference to an element in an array. For multidimensional arrays, multiple indexes must be specified (up to the total number of dimensions of the array).
For any one dimension
d in array
a, any index outside of the range (
LBound(a(), d), UBound(a(), d)) will result in a runtime error.
Example
Dim array(4) As Integer = { 0, 1, 2, 3, 4 }
For index As Integer = 0 To 4
Print array(index)
Next
will produce the output:
0 1 2 3 4
Differences from QB
See also