Ruby Integer downto() function with example
The downto() function in Ruby returns all the numbers less than equal to number and greater than equal to limit. It iterates the given block, passing in decreasing values from int down to and including limit. If no block is given, an Enumerator is returned instead.
Parameter: The function takes the integer from which the number starts decreasing. It takes a parameter which is the limit till which the decreasing occurs. It also takes an enumerator.
Return Value: The function returns all the numbers less than equal to number and greater than equal to limit.
8 7 6 5 4 3 2 1 0 8 -8
5 4 3 2 1 0 -1 -2 -3 5 19 18 17 19
My Personal Notes arrow_drop_up
Please Login to comment...