Ruby - Class Methods and Variables
Identify the error in this Ruby code:
hash = {a: 1, b: 2}
hash.freeze
hash[:c] = 3hash = {a: 1, b: 2}
hash.freeze
hash[:c] = 3freeze on hash makes it immutable.[:c] = 3 modifies the frozen hash, causing RuntimeError.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions