また会いましたねRuby
まだまだいいかげんにirbとおしゃべり。
irb(main):017:0> "hoge"[0..3] => "hoge" irb(main):018:0> "hoge"[0,3] => "hog" irb(main):020:0> "hoge"[-2,3] => "ge" irb(main):049:0> "hoge".split // => ["h", "o", "g", "e"] irb(main):051:0> $KCODE="s" => "s" irb(main):052:0> "漢字漢字".split // => ["漢", "字", "漢", "字"] irb(main):040:0> if 0 then "t" else "f" end => "t" irb(main):041:0> if [] then "t" else "f" end => "t" irb(main):042:0> if "" then "t" else "f" end (irb):42: warning: string literal in condition => "t" irb(main):044:0> if false then "t" else "f" end => "f" irb(main):045:0> if nil then "t" else "f" end => "f" irb(main):032:0> a=gets.split;h=Hash[*a.zip(a.map{|i|i.to_i}).flatten] 0 1 2 3 => {"0"=>0, "1"=>1, "2"=>2, "3"=>3}
日本語の扱いやすさは特筆に値するような予感。
俺はもっと他人のコードを読んだ方が良いと思う。