Block definition - difference between braces and do-end?
问题 can anybody explain why the following code aborts with an error irb(main):186:0> print ((1..10).collect do |x| x**2 end) SyntaxError: (irb):186: syntax error, unexpected keyword_do_block, expecting ')' print ((1..10).collect do |x| x**2 end) ^ (irb):186: syntax error, unexpected keyword_end, expecting $end print ((1..10).collect do |x| x**2 end) ^ from /usr/bin/irb:12:in `<main>' whereas following code with the same functionality works as expected ? irb(main):187:0> print ((1..10).collect {