<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 01 Jul 2003 12:10:52 +0100 
From   : "Fewell, Steve" <Steve.Fewell@...>
Subject: BASIC 4 bug and more on the ON keyword!

Hi all,

Is anyone else aware of this bug in BBC BASIC?
10 A%=1000
20 J%=1
30 ON A% GOTO 50,60,70:IF J%=1 PRINT"J%=1" ELSE PRINT"J%=0"
40 PRINT"40":END
50 PRINT"50":END
60 PRINT"60":END
70 PRINT"70":END

When running this program the output is:
J%=0    [which is incorrect!]
40

Basically, the problem is that if the variable in an ON-statement is > 255,
and an IF..ELSE statement is present on the same line after the ON
statement, the ELSE part will be executed as the ELSE for the ON statement,
as BBCBASIC fails to check for a ':' when searching for the ELSE part of an
ON statement!


Additionally, the ON statement can also be used in conjunction with an IF
statement as follows:
IF accepted% THEN ON acceptlevel% GOTO 1000, 2000, 3000 ELSE PRINT "No Valid
Acceptance found"

In this case, the ELSE is used in two different statements [try putting that
into BNF form!], firstly as a ELSE to the IF statement (when accepted% is
false) and secondly a a ELSE to the ON statement when acceptlevel% is out of
range! Useful?!

Regards,
Steve.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>