ruby中出现unexpected tIDENTIFIER!求大神指点
阿神
阿神 2017-04-22 09:00:09
0
1
702
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>'
阿神
阿神

闭关修行中......

reply all(1)
黄舟

I found the problem. When I used rubymine on mac, it might have jumped to windows mode. There was an "n" at the end of each sentence

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template