subscript out of range
subscript out of range
OK, i got a question. What does subscript out of range mean?
Arrays
It means you have an array and it has a certain dimension (the maximum number of elements in the array) and something in your program is trying to use or assign an element beyond or larger than that. For example:
would generate such an error.
Sometimes a misplaced parenthesis "(" in a program can make BASIC think you're refering to an array when you never intended to, thus causing an array subscript error.
Also, in BASIC you can refer to the first 10 elements of an array without actually using DIM first, but that's not good programming practice.
Code: Select all
DIM x(25)
y=x(27)=3
Sometimes a misplaced parenthesis "(" in a program can make BASIC think you're refering to an array when you never intended to, thus causing an array subscript error.
Also, in BASIC you can refer to the first 10 elements of an array without actually using DIM first, but that's not good programming practice.
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
--- Time flies like an arrow, but fruit flies like a banana ---
Re: Arrays
[quote="Zim"].....
For example:
would generate such an error.
Ooops, I'm sure you meant:
*****
For example:
Code: Select all
DIM x(25)
y=x(27)=3
Ooops, I'm sure you meant:
Code: Select all
x(27)=3