Development > Developer Blog/Q&A
DATA Statements can go after SUBS without RESTORE.
(1/1)
Pete:
Something about where DATA can be placed you might want to look at.
This was in a discussion where I noted QB64 will allow the user to put DATA statements after SUBS.
Both are OKed in the IDE. The first will compile, the second won't...
myx
sub myx
print "1"
REM restore mylabel
read a
print a
end sub
REM mylabel:
data 100
============================================
myx
sub myx
print "1"
restore mylabel
read a
print a
end sub
mylabel:
data 100
-------------------------------
It seems once you use RESTORE it fails to compile, unless of course the Mylable and DATA are moved up before the SUB routine.
It looks like you might want to change the IDE so it rejects DATA statements after SUBS and FUNCTIONS., and adjust the compiler so it does not allow one like the first example to compile.
Pete
Galleon:
DATA is allowed in SUBs/FUNCTIONs in QB64 by design (unlike QBASIC). It isn't allowed between SUBs/FUNCTIONs. I'll look into any inconsistencies.
Navigation
[0] Message Index
Go to full version