List Index Out Of Range

The term ”List index out of range” is a programming language error term.

It means that the index that is declared has exceeded the rage declared. In simple terms, it means that you are trying to use an index or indexes that are not valid or out of range of what has been declared.

For example,
When 4 elements are declared to a list, only 0, 1, 2 and 3 which total to four are used.  4 is not used. If you try using 1, 2, 3, 4 or 0, 1, 2, 3, 4 then ”List out of range” error will be prompted. Automatically, zero (0) will always be factored in, and that’s why you use total -(minus) 1.

Now, to correct that error you need to watch, print or echo the counter variable before you use the array.

Leave a Reply

Your email address will not be published. Required fields are marked *