So this works ascendingly
(1..5).to_a => [1, 2, 3, 4, 5]
But this doesn’t
(5..1).to_a => []
I’m trying to get a descending sequence from an arbitrary ceiling. Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this:
Of course, there’s a corresponding
#upto. If you want steps, you can do this: