Find the maximum elements in an array using ruby
def max_value(array)
max = array[0]
array.each do |i|
if i > array[0]
max = i
end
end
max
end
array = [6,7,8,9,43,3,22,675,343,5454]
max_value(array) #calling method
What is interactor? Interactor provides a common interface for performing complex user interactions An interactor is a simple, sin...
No comments:
Post a Comment