Hatena::Groupruby

mrのRuby学習帳 このページをアンテナに追加 RSSフィード

2010-05-23

Hashのdelete_if Hashのdelete_if - mrのRuby学習帳 を含むブックマーク

http://www.ruby-lang.org/ja/man/html/Hash.html

irb(main):055:0* a_hash = {"a"=>1,"b"=>2,"c"=>3}
=> {"a"=>1, "b"=>2, "c"=>3}
irb(main):056:0> a_hash.delete_if{| x, y | y = "a" }
=> {}
irb(main):057:0> a_hash
=> {}
irb(main):058:0>

よくわからない。

いや、違う。こうだ。

irb(main):073:0* a_hash = {"a"=>1,"b"=>2,"c"=>3}
=> {"a"=>1, "b"=>2, "c"=>3}
irb(main):074:0> a_hash.delete_if{| x, y | y == 2 }
=> {"a"=>1, "c"=>3}
irb(main):075:0> a_hash
=> {"a"=>1, "c"=>3}
irb(main):076:0>

AngelAngel2012/08/14 13:17That's an apt answer to an intreetsing question

ppvwdtvkppvwdtvk2012/08/14 23:35EqrHQ4 <a href="http://jqtolsytvcxz.com/">jqtolsytvcxz</a>

blguuijfblguuijf2012/08/15 04:09xLOn04 , [url=http://ehnebixjcnpq.com/]ehnebixjcnpq[/url], [link=http://bxwqyckkryvh.com/]bxwqyckkryvh[/link], http://lycmtsyvfkkm.com/

fnbajgqloefnbajgqloe2012/08/16 19:078XYCex , [url=http://oygkofasvwhi.com/]oygkofasvwhi[/url], [link=http://urmtguhjvjet.com/]urmtguhjvjet[/link], http://zujqwbfuvdla.com/