Syntax rules about arrays
I am getting 2 different rules about these in the classes I am taking. First textbook said that:
for i = 0 to 11
set array[j] = j
That this would cause a run-time error because the integer array 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
Declare Integer index = 0
For index = 0 to 5
Isn't this the same thing? The subscript in price is going to be 0-4 and by setting the index this way won't it search for the 5th spot in the element?