From what I've read, the main reason they exist is to give more readability and brevity. Seems the point is less commas and quotes. That being said, I've never made a habit of using them.
When I wrote this, I was thinking: more options means better, but in all honesty, I rarely take advantage of a lot of Ruby's alternatives. For example, I've never once used "detect" though I've used "find" a ton.
I tend to stick with what whatever I learn initially unless there's a good reason to change. Rethinking it now, I think I'm back to not liking the shorthand, lol.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I remember in early stages of learning Ruby being annoyed be these too, asking myself “Why would I want to use this??”.
And honestly, I think they’re pretty cool, but I still don’t quite understand when you should use these over just writing the array itself.
I’d love to know the appropriate/optimal use cases!
From what I've read, the main reason they exist is to give more readability and brevity. Seems the point is less commas and quotes. That being said, I've never made a habit of using them.
When I wrote this, I was thinking: more options means better, but in all honesty, I rarely take advantage of a lot of Ruby's alternatives. For example, I've never once used "detect" though I've used "find" a ton.
I tend to stick with what whatever I learn initially unless there's a good reason to change. Rethinking it now, I think I'm back to not liking the shorthand, lol.