def test(name)
yield(name)
end
test("licheng"){|name| puts "hello #{name}"}
上麵這段代碼出現以下錯誤,不知為何?
-e:1:in `load': /Users/lic/RubymineProjects/test/test1.rb:1: syntax error, unexpected tIDENTIFIER, expecting end-of-input (SyntaxError)
test("licheng"){|name| puts "hell...
... ^
from -e:1:in `<main>'
找到問題所在了,我在mac下用rubymine的時候,可能是跳成了windows模式,每一句代嗎的後面都會帶上"n"