From: "Иван Бишевац" Date: 2012-11-29T22:25:59+09:00 Subject: Re: Getting the smallest Items of an Array --047d7b16373932f1f404cfa23994 Content-Type: text/plain; charset=UTF-8 Try this: n = [4, 6, 7, 2, 15] def min(n) minimum = n[0] n.each do |element| if element < minimum minimum = element end end return minimum end puts min(n) --047d7b16373932f1f404cfa23994 Content-Type: text/html; charset=UTF-8 Try this:
n = [4, 6, 7, 2, 15]

def min(n)
minimum = n[0]
n.each do |element|
if element < minimum
minimum = element
end
end
return minimum
end

puts min(n)
--047d7b16373932f1f404cfa23994--