>
> I would prefer that the code in example 1, if in a real program, use a
different local
> variable, but I did understand with little effort that it was intended to
be a local
> variable.  Any other choice would have increased my surprise.  Several
languages that use
> an approximately equivalent form also require that tie loop control
variable be local.  I
> think that the languages that don't make this choice are in the minority.
And deservedly
> so.

Does this surprise you, then?

index = 345

for index in 1..5
  print "#{index}\n"
end

print index   # Prints 5


Hal


> -- (c) Charles Hixson
> --  Addition of advertisements or hyperlinks to products specifically
prohibited
>
>