這是我的PigLatin代碼和它的作品很好,但我需要使它的互動與ARGV,它應該是:如何使我的代碼互動與ARGV在RUBY
$ ruby pig_latin.rb
豬香蕉垃圾箱蘋果大象 => igpay ananabay菸灰缸appleway elephantway
def pig_latin(input) first_char = input[0,1] vowels = "aeiouAEIOU" if vowels.include?(first_char) word = input[1..-1] + first_char + "way" else word = input[1..-1] + first_char + "ay" end end
感謝@tadman :) –