「Ruby入門」for文で繰り返し処理をするサンプル

サンプル
cityinfo = {:tokyo => “東京", :oosaka => “大阪", :fukuoka => “福岡",:nagoya => “名古屋"}
for key, value in cityinfo
puts “KEY:#{key} VALUE:#{value}"
end
#=>KEY:tokyo VALUE:東京
# KEY:oosaka VALUE:大阪
# KEY:fukuoka VALUE:福岡
# KEY:nagoya VALUE:福岡

Ruby

Posted by arkgame