Episode 19b - Things That Can Go Wrong With Hashes

Exercises

  1. Assume that we see this inside irb:
    hash["a"].capitalize + hash["b"] + hash["c"].upcase
    TypeError: no implicit conversion of nil into String
      from (irb):4:in `+'
    
    Create hash that would cause us to get this error.
  2. Let's say we have an empty hash assigned to a variable called 'hash'. If we were to say:
    p hash["wat"]
    what would it return?
  3. Next, define the above hash in a way so that it would return the number 0 instead.