A=Array[3,6,1,17,-22,11,2,5,6,7] def max bigindex=0 A.length.times{|i| if (A[i]>A[bigindex]) bigindex=i end } return bigindex end print("The max index is #{max}\n")