Created
June 21, 2016 15:07
-
-
Save jorrizza/18a4dad2328c02e30471c67ae2864230 to your computer and use it in GitHub Desktop.
I kind of hate Ruby for this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> wat = Hash.new {|h, k| h[k] = "Wat #{k}?"} | |
=> {} | |
irb(main):002:0> wat.keys | |
=> [] | |
irb(main):003:0> wat.class | |
=> Hash | |
irb(main):004:0> puts 'wat?' if wat['foo'] | |
wat? | |
=> nil | |
irb(main):005:0> wat.keys | |
=> ["foo"] | |
irb(main):006:0> wat | |
=> {"foo"=>"Wat foo?"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment