# 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"
Ruby
输出:
min() method form :for
min() method form :["for","geeks"]
Ruby
例子 #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"
Ruby
输出:
min() method form :["I","can","code","for"]
min() method form :["I"]