Re: [問題] 如何再送參數到method?

看板Ruby作者 (godfat 真常)時間16年前 (2009/03/10 13:27), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/5 (看更多)
※ 引述《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
文章代碼(AID): #19jVfFwj (Ruby)
文章代碼(AID): #19jVfFwj (Ruby)