看板 Ruby 關於我們 聯絡資訊
※ 引述《Esh ()》之銘言: : 換這個範例問可能比較單純 : input = ARGV[0] : def somemethod(value="#{input}") ^^^^^^^^^^ 這樣做根本沒有意義,因為你所想要的 input 本來就是字串 把字串轉成字串是多此一舉 此外,input 是 top level 的 local variable, 這樣寫看不到。既然 input 是 ARGV[0], 何不直接寫 ARGV[0] ? -- #!/usr/bin/env ruby [露比] /Programming (Kn|N)ight/ 看板《Ruby》 # if a dog nailed extra legs that http://www.ptt.cc/bbs/Ruby/index.html # walks like an octopus, and Welcome ~Ruby@ptt~ # talks like an octopus, then ◢█◣ http://www.ruby-lang.org/ # we are happy to treat it as http://www.ruby-doc.org/ # if it were an octopus. http://www.rubyforge.org/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.128.121.85