View Single Post
Old 22 August 2015, 20:45   #289
Mrs Beanbag
Glastonbridge Software
Mrs Beanbag's Avatar
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,202
Originally Posted by Lonewolf10 View Post
I personally don't understand lines such as:
For I in A ...
I in A? If I=1 what does A equal? 1?
just recalling the original example...
Let A=0 To 10 Step 2 For I in A ...A equals "0 To 10 Step 2", or to put it another way, [0, 2, 4, 6, 8, 10]
The suggestion is to allow users to assign ranges to variables (and use type inference to allow different types to be assigned to variables).
One could just as easily write it in-line, of course, like so:
For I in 0 To 10 Step 2
where the only difference there between that and normal BASIC syntax is the use of "in" instead of "="; because it is not assigning I to the range, but to each element in the range in turn. Thus the symbols "To" and "Step" have meanings of their own, and are not just part of For's special syntax.
Mrs Beanbag is offline  
Page generated in 0.05057 seconds with 9 queries