S
Stanislav Orlenko
Hi
I'm reading documentation on
http://rubylearning.com/satishtalim/ruby_blocks.html
I've just tried execute this code:
x = 10
5.times do |x|
puts "x inside the block: #{x}"
end
puts "x outside the block: #{x}"
and my output:
x inside the block: 0
x inside the block: 1
x inside the block: 2
x inside the block: 3
x inside the block: 4
x outside the block: 4
BUT in documentation I see that output should be:
x inside the block: 0
x inside the block: 1
x inside the block: 2
x inside the block: 3
x inside the block: 4
x outside the block: 10
My ruby:
#ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
Can someone clarify the situation? http://rubylearning.com contains
wrong documentation?
Thanks in advance
I'm reading documentation on
http://rubylearning.com/satishtalim/ruby_blocks.html
I've just tried execute this code:
x = 10
5.times do |x|
puts "x inside the block: #{x}"
end
puts "x outside the block: #{x}"
and my output:
x inside the block: 0
x inside the block: 1
x inside the block: 2
x inside the block: 3
x inside the block: 4
x outside the block: 4
BUT in documentation I see that output should be:
x inside the block: 0
x inside the block: 1
x inside the block: 2
x inside the block: 3
x inside the block: 4
x outside the block: 10
My ruby:
#ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
Can someone clarify the situation? http://rubylearning.com contains
wrong documentation?
Thanks in advance