View Single Post
Old 19 August 2015, 15:19   #248
Registered User

Dunny's Avatar
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 661
Originally Posted by tomcat666 View Post
So the new ZX Spectrum will be rolled out to all UK schools ? WOW
Possibly, we don't know yet - it depends on how successful we are.

Originally Posted by Mrs Beanbag View Post
In any case, one cannot do:
Let A=0 To 10 Step 2
For I in A ...
Which is a shame, because that would be hella cool. One could it imagine it working also on arrays and strings...
Let A="Hello world!" : REM Type inference!
For I in A:
   Print I
Result: each character of the string on its own line...
Actually, I can do this:

10 FOR EACH a$ in ["Hello world!"]: PRINT a$: NEXT a$

10 DIM a(32)
20 FOR EACH b IN a()
30 PRINT b
40 NEXT b
or even

10 INPUT a$
20 IF a$ IN ["Yes", "yes", "YES"] THEN PRINT "Yay!" ELSE PRINT "Boo!"
and of course

10 IF b IN [1 TO 10,20,30 TO 40] THEN ...
20 IF c$ IN ["0" TO "9", "A" TO "F"] THEN ...
Where the first tests that b is between 1 and 10 inclusive, or is 20, or is between 30 and 40 inclusive. The second tests for hexchars.

Yes, it's not part of the original Dartmouth spec (and in fact is very close to Pascal) but then the original Sinclair BASIC did things that aren't in the spec - though their string handling was genius and stands up well even today - so what's wrong with making my interpreter do things a little better?

Dunny is offline  
Page generated in 0.09139 seconds with 9 queries