{{fbdoc item="title" value="Operator () (Array index)"}}----
Returns a reference to an element in an array

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] **()** ( //lhs//() [[KeyPgAs|as]] //T//, [[KeyPgByref|byref]] //rhs// [[KeyPgAs|as]] [[KeyPgInteger|integer]], ... ) [[KeyPgByrefFunction|byref]] [[KeyPgAs|as]] //T//
##
{{fbdoc item="usage"}}##
	//result// = //lhs// **(** //rhs// [, ...] **)**
##
{{fbdoc item="param"}}
	##//lhs//##
		An array.
	##//rhs//##
		An index of an element in the array.
	##//T//##
		Any data type.

{{fbdoc item="desc"}}
	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 dimension ##//d//## in array ##//a//##, any index less than ##[[KeyPgLbound|Lbound]](//a//, //d//)## or greater than ##[[KeyPgUbound|Ubound]](//a//, //d//)## will result in a runtime error.

{{fbdoc item="ex"}}

{{fbdoc item="filename" value="examples/manual/operator/arrayindex.bas"}}%%(freebasic)
dim array(0 to 4) as integer = { 0, 1, 2, 3, 4 }

for index as integer = 0 to 4
	print array(index);
next
print
%%
	will produce the output:

%%
 0 1 2 3 4
%%

{{fbdoc item="diff"}}
	- None

{{fbdoc item="see"}}
	- ##{{fbdoc item="keyword" value="KeyPgOpPtrIndex|Operator [] (Pointer index)"}}##

{{fbdoc item="back" value="CatPgOpIndexing|Indexing Operators"}}{{fbdoc item="back" value="CatPgOperators|Operators"}}