Today I learned that as of Ruby 3, we can omit values from hashes if the key name matches the expression:
# In Rubies < v3:
a = "alice"
b = "bob"
h = {a: a, b: b}
# In Rubies >= v3:
a = "alice"
b = "bob"
h = {a:, b:}
Today I learned that as of Ruby 3, we can omit values from hashes if the key name matches the expression:
# In Rubies < v3:
a = "alice"
b = "bob"
h = {a: a, b: b}
# In Rubies >= v3:
a = "alice"
b = "bob"
h = {a:, b:}
For further actions, you may consider blocking this person and/or reporting abuse
Sulman Baig -
Turing -
TomoKanazawa -
SHABBIR M.W. -
Top comments (0)