Ruby | Array min() function
Array#min() : min() is a Array class method which returns the minimum value in this array.
Syntax: Array.min()
Parameter: Array
Return: the minimum value in this array.
Example #1 :
# Ruby code for min() method # declaring array a = %w[for geeks] # min method example puts "min() method form : #{a.min()}\n\n" puts "min() method form : #{a.min(2)}\n\n" |
chevron_right
filter_none
Output :
min() method form : for min() method form : ["for", "geeks"]
Example #2 :
# Ruby code for min() method # declaring array a = %w[hi I can code for geeks] # min method example puts "min() method form : #{a.min(4)}\n\n" puts "min() method form : #{a.min(1)}\n\n" |
chevron_right
filter_none
Output :
min() method form : ["I", "can", "code", "for"] min() method form : ["I"]
Recommended Posts:
- Ruby | Array max() function
- Ruby | Array none?() function
- Ruby Array () function with example
- Ruby | Array pop() function
- Ruby | Array map() function
- Ruby | Array one?() function
- Ruby | Array zip() function
- Ruby | Array &() function
- Ruby | Array <=> function
- Ruby | Array take() function
- Ruby | Array rotate() function
- Ruby | Array sample() function
- Ruby | Array abbrev() function
- Ruby | Array repeated_combination() function
- Ruby | Array rindex() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

