Syntax rules about arrays

I am getting 2 different rules about these in the classes I am taking. First textbook said that:
integer array[11]
integer j

for i = 0 to 11
set array[j] = j
end for
That this would cause a run-time error because the integer array[11] sets the subscript from 0-10…and therefor by writing for i = 0 to 11 causes it to search for the 11th element which would only go to 10 based on how this was written.

Then it says later that you could in fact write this:
Declare Real price[5]
Declare Integer index = 0

For index = 0 to 5
Isn’t this the same thing? The subscript in price[5] is going to be 0-4 and by setting the index this way won’t it search for the 5th spot in the element?