Ruby program to demonstrate the downto() function

Ruby program to demonstrate the downto() function Article has many meanings. We are going to know this topic clearly through this article. We hope you like this article.

Ruby program to demonstrate the downto() function

Ruby program to demonstrate the downto() function

# Ruby program to demonstrate the 
# downto() function

num1 = 5 ;
num2 = -5;

# Prints the number down to 1
num1.downto(1){| i | print i, " "}

print "\n";

# Prints the number down to -10
num2.downto(-10){| i | print i, " "}
5 4 3 2 1 
-5 -6 -7 -8 -9 -10

Final Words

Ruby program to demonstrate the downto() function We got to know our topic very clearly. And if you have any doubts about this article you can let us know your doubts via comment.

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment