空格的 ”陷阱“

今天无意中碰到一个空格带来的“陷阱”:

def a
  10
end

b = a+1
=> 11

b = a + 1
=> 11

b = a+ 1
=> 11

b = a +1
ArgumentError: wrong number of arguments (1 for 0)
        from (irb):8:in `a'
        from (irb):8

你可能感兴趣的:(Blog,Ruby)