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"