牌語備忘録 -pygo

あくまでもメモです。なるべくオフィシャルの情報を参照してください。

牌語備忘録 -pygo

Rubyのハッシュのメモ

irb(main):011:0> d = {"zero"=>0, "one"=>1, "two"=>2}
=> {"zero"=>0, "one"=>1, "two"=>2}
irb(main):012:0> d["zero"]
=> 0
irb(main):013:0> d.keys
=> ["zero", "one", "two"]
irb(main):014:0> d.values
=> [0, 1, 2]
irb(main):015:0> d.store("three", 3)
=> 3
irb(main):017:0> d
=> {"zero"=>0, "one"=>1, "two"=>2, "three"=>3}
irb(main):018:0> d.key?("two")
=> true
irb(main):019:0> d.key?("ten")
=> false
irb(main):020:0> d.merge({"eleven" => 11 })
=> {"zero"=>0, "one"=>1, "two"=>2, "three"=>3, "eleven"=>11}
irb(main):021:0> d
=> {"zero"=>0, "one"=>1, "two"=>2, "three"=>3}
irb(main):022:0> d.key(1)
=> "one"