Possible Duplicates:
Using do block vs brackets {}
What is the difference or value of these block coding styles in Ruby?
Why does:
test = [1, 1, 1].collect do |te|
te + 10
end
puts test
Works, but not:
puts test = [1, 1, 1].collect do |te|
te + 10
end
And yet this works:
puts test = [1, 1, 1].collect { |te|
te + 10
}
Is there a difference between the do/end construct and the { } construct for blocks I am not aware of?