1个括号:
print ( (1..10).collect do |x| x**2 end ) SyntaxError: compile error
更多细节:
(irb):1: syntax error, unexpected kDO_BLOCK, expecting ')' print ( (1..10).collect do |x| x**2 end ) ^ (irb):1: syntax error, unexpected kEND, expecting $end print ( (1..10).collect do |x| x**2 end ) ^
2个括号:
print (( (1..10).collect do |x| x**2 end )) 149162536496481100=> nil
print (a) do <...>
我理解和之间的区别print(a) do <...>
。但我的情况有什么不同?为什么两个括号不一样?