In ruby docs, there is this text:
Block parameters are actually local variables. If an existing local of the same name exists when the block executes, that variable will be modified by the call to the block. This may or may not be a good thing.
I wrote the code below to test this:
x = 0
3.upto(6) {|x| puts x}
puts x
# output are:
# 3
# 4
# 5
# 6
# 0
The variable x is not changed. Why? This is against the docs.
enumeratoris block parameter it scope is limited inside the block only where as the otherxis scope in through out the code