1
簡單gets.chomp出於某種原因,當我運行:試圖運行在崇高
名= gets.chomp
把名字
我得到的錯誤:
得到: 1:<main>': undefined method
格格」的零:NilClass(NoMethodError)
如果刪除了.chomp並運行:
名=得到
把名字
我沒有得到任何提示或錯誤,控制檯只是給了我完成的時間。我究竟做錯了什麼?
通過我用崇高的方式,使用Ruby
簡單gets.chomp出於某種原因,當我運行:試圖運行在崇高
名= gets.chomp
把名字
我得到的錯誤:
得到: 1:<main>': undefined method
格格」的零:NilClass(NoMethodError)
如果刪除了.chomp並運行:
名=得到
把名字
我沒有得到任何提示或錯誤,控制檯只是給了我完成的時間。我究竟做錯了什麼?
通過我用崇高的方式,使用Ruby
你可以嘗試運行在終端這個文件中配置。就像這樣:
ruby test.rb
... #puts名 ...
如果運行良好,這意味着你的問題是另一種情況。你可以轉到Sublime Text 2 Launch ruby file in terminal
可能的重複[試圖在崇高運行一個簡單的gets.chomp](http://stackoverflow.com/questions/15086154/trying-to-run-a-simple-gets-chomp-in -昇華) – knut 2013-06-02 20:55:06