We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
which is the difference between:
a = *(1..3) # => [1, 2, 3]
and this:
a = (1..3).to_a # => [1, 2, 3]
And which is accepted? And there is another way more readable?
The text was updated successfully, but these errors were encountered:
This is a good question and one that I've wondered about myself. I asked some of the rubyists I know and they opted for:
a = (1..3).to_a
for readability reasons.
Also .to_a is a faster operation.
.to_a
So, .to_a is faster and more explicit.
Sorry, something went wrong.
Indeed. I'd definitely go for .to_a over using the splat operator in this situation. Always optimize for readability!
No branches or pull requests
Hello,
which is the difference between:
and this:
And which is accepted? And there is another way more readable?
The text was updated successfully, but these errors were encountered: