Reputation: 23
I need to create an array of integers.
The array contains the number 0, and then number 10 to 31.
I understand that I can type it in, but I really wish there is an eloquent Ruby way to do it.
Upvotes: 2
Views: 328
Reputation: 5721
@xdazz answer is better than this but if you aren't comfortable using the splat operator here is an alternate(less pretty) approach:
[0, (10..31).to_a].flatten
Upvotes: 1