Ruby - Hashes
How can you use
Example:
dig to safely access the first element of an array nested inside a hash?Example:
h = {arr: [10, 20, 30]}dig to safely access the first element of an array nested inside a hash?h = {arr: [10, 20, 30]}h.dig(:arr, 0) accesses the first element (10) safely.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions