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
Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.
Anh Trần Tuấn -
Pooyan Razian -
Bruh Buh -
Bruh Buh -
Top comments (0)