for the sake of learning, I built a sort method to sort an array of
numbers manually rather than with the built-in Array#sort method.

below is my code. Would you say this is a "good" way to do it?

def sort_array(array)
  i = 0
  while i < array.length do
    index_max = max_array_index(array, array.length - i)
    temp = array[index_max]
    array[index_max] = array[array.length - i - 1]
    array[array.length - i - 1] = temp
    i += 1
  end
  return array
end

def max_array_index(array, size)
  i = 1
  i_max = 0
  while i < size do
    if array[i] > array[i_max] then
      i_max = i
    end
    i += 1
  end
  return i_max
end

Thank you for your comments.
-- 
Posted via http://www.ruby-forum.com/.