if array[5] == exist:
	do.

You can check if the index is within the size of the array using something like this (untested, off memory):

if 5 <= array.size()-1:
	print array[5]

(Moved to programming category)

2 years later