Published
- 1 min read
reverse range ruby using steps
The solution for this is noted below
reverse range ruby using steps
Solution
range = 5...0
Array((range).step(-2))
## will give 5 3 1
Try other methods by searching on the site. That is if this doesn’t work