Why "C"?
Posted: Wed May 26, 2021 5:53 pm
I have this (t2p formatted) code:
@input:
IF INKEY$="3" THEN goto @theend
IF INKEY$ <>"1" AND INKEY$ <>"2" THEN GOTO @input
LET D=VAL(INKEY$)
[...]
@theend
[...]
("3" jumps to the end of the program, "1" or "2" roll one or two dice respectively).
Rarely (let's say 1% of the time), when this part of the code is parsed, the program stops and I get a "C" report code on the boldface line, which according to the manual means "The text of the (string) argument of VAL does not form a valid numerical expression".
This is surprising, considering that when this happens I'd have just typed either 1 or 2, and even if I had typed any other key, the previous line would have caused the offending line not to be processed.
What do you think is going on?
@input:
IF INKEY$="3" THEN goto @theend
IF INKEY$ <>"1" AND INKEY$ <>"2" THEN GOTO @input
LET D=VAL(INKEY$)
[...]
@theend
[...]
("3" jumps to the end of the program, "1" or "2" roll one or two dice respectively).
Rarely (let's say 1% of the time), when this part of the code is parsed, the program stops and I get a "C" report code on the boldface line, which according to the manual means "The text of the (string) argument of VAL does not form a valid numerical expression".
This is surprising, considering that when this happens I'd have just typed either 1 or 2, and even if I had typed any other key, the previous line would have caused the offending line not to be processed.
What do you think is going on?