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
Abhay Singh Kathayat -
Abhay Singh Kathayat -
Nozibul Islam -
アッシャー -
Top comments (0)