Error message: Case selector is out of range.
Author |
Message |
renaissance
|
Posted: Wed Jan 23, 2008 5:00 pm Post subject: Error message: Case selector is out of range. |
|
|
I'm getting this error from my code:
var ans1, data : string
var contactNum, menuNum, cont, stream, counter : int
contactNum := ContactCount + 1
var nums : string
var firstName, phoneNum, aptNum, lastName, address, city, province, country : array 1 .. contactNum of string
nums := "1234567890"
counter := 0
open : stream, "contacts.txt", get
if contactNum - 1 > 0 then
for i : 1 .. contactNum - 1
loop
exit when eof (stream)
get : stream, data : *
counter := counter + 1
case counter of
label 1 :
firstName (i) := data
label 2 :
lastName (i) := data
label 3 :
phoneNum (i) := data
label 4 :
address (i) := data
label 5 :
aptNum (i) := data
label 6 :
city (i) := data
label 7 :
province (i) := data
label 8 :
country (i) := data
label 9 :
end case
end loop
end for
end if
Help please? Thanks. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Gooie
|
Posted: Wed Jan 23, 2008 5:43 pm Post subject: Re: Error message: Case selector is out of range. |
|
|
You didn't declare 'ContactCount'. |
|
|
|
|
|
renaissance
|
Posted: Wed Jan 23, 2008 5:46 pm Post subject: RE:Error message: Case selector is out of range. |
|
|
Well...that wasn't all my code :p just a snippet. And I did...I simply went through another means to complete the task I wanted to though...
Now to figure something else out. |
|
|
|
|
|
Gooie
|
Posted: Wed Jan 23, 2008 6:04 pm Post subject: Re: Error message: Case selector is out of range. |
|
|
It probably means it picked up data it didn't find a match to, in the case statement. Make a default, label :, then it should go away. |
|
|
|
|
|
|
|