Dictionary: repeat
Richmond
richmondmathewson at gmail.com
Sat Jul 23 09:37:49 EDT 2016
I was reading an incredibly tedious book about Visual BASIC 6 last night
[ left over from my M.Sc. in "Computers and IT" from the University of
Abertay ] and
wondering about various things such as "step". Reading computer manuals
is, in my experience, really great in the same sort of way banging one's
head on the wall is: it feels just so good when it stops!
1. Funnily enough "step" doesn't seem to be listed in the 7.1.4 Dictionary.
2. I looked up "repeat" and found this:
repeat with myLine = 20 down to 1 step -2
and "there 'step' was!
3. But, as usual with me, the main point I want to make has not got that
much to do with "step"
but a remark that struck me as rather odd in the "repeat" entry in the
Dictionary:
*Note:* It is possible to change the counter variable in a statement in
the loop. However, doing this is not recommended, because it makes the
loop logic difficult to follow:
repeat with x = 1 to 20 -- this loop actually repeats ten times
answer x
add 1 to x -- not recommended
end repeat
Why is that "not recommended" [I do 'that' all the time and have never
had a problem] ?
4. Now to the "crunchy bit":
I have been telling the children who have been coming to Summer
programming classes
for the last 3 years that they should do this sort of thing the way the
Dictionary states is
"not recommended". If someone can explain in a way that makes reasonable
sense, I will
give up doing that and teach them the other way from now on.
Richmond.
More information about the use-livecode
mailing list