11-16-2022, 11:53 PM
(11-16-2022, 11:13 PM)SMcNeill Wrote:(11-16-2022, 11:04 PM)Pete Wrote: This oversight upsets the Continuity Principle.
Code: (Select All)DATA "1,2,3" ' This doesn't works. IDE flags it.
DATA 1,2,3 ' This doesn't run, but the IDE doesn't flag it.
So when Rob put this together, he simply missed a condition. Since the IDE is set up to catch syntax errors before compilation, yes, this should at some point in time be corrected. In therms of priorities, things like this and the IF THEN ELSE anomaly are certainly backseat compared to a memory leak in SCREEN Zero. Oh the horror!!!!
Pete
The reason this isn't flagged by the IDE as an error, is simply because it's not.
Code: (Select All)For i = 1 To 4
Read a$
Print a$
Next
Data 1,2,3 ' This doesn't run,but the IDE doesn't flag it.
You've got mixed data inside your data stream there -- 2 numeric values and 2 string values. The error you get, happens to be a run-time error because, at run-time, you're trying to read a string into a numeric variable.
Makes perfect sense to me.
Ah, I forgot that DATA can be read as either a STRING type or Var Type. Good point!
Code: (Select All)
FOR i = 1 TO 3
READ a
PRINT a
NEXT
' Note the colon added is required for it to run.
DATA 1,2,3: REM This works as a var type or string type.
RESTORE
FOR i = 1 TO 3
READ a$
PRINT a$
NEXT
Also interesting that the RESERVED word REM can be used as a DATA element. So can the single quote.
I'll go back and edit post 11 accordingly.
Pete