+ 1

how to print numbers in reverse using Ruby for loop. like 10 to 0.

Question edited. Give me an example to print in reverse like 10 to 0. Output 10 9 8 7 6 5 4 3 2 1 0 In Ruby. https://code.sololearn.com/cYH588x3vUa1/?ref=app

2nd Dec 2019, 10:23 PM
Balaji
Balaji - avatar
2 Answers
+ 3
10.downto.(0) {|i| puts i}
2nd Dec 2019, 11:15 PM
Javier Felipe Toribio
Javier Felipe Toribio - avatar