use while loop to convert elements in an array to capitalized case
#!/usr/bin/env ruby
i = 0
breeds = [ "quarter", "arabian", "appalosa", "paint" ]
puts breeds.size # => 4
temp = []
while i < breeds.size do
temp << breeds[i].capitalize
i += 1
end
temp.sort! # => ["Appalosa", "Arabian", "Paint", "Quarter"]
breeds.replace( temp )
p breeds # => ["Appalosa", "Arabian", "Paint", "Quarter"]
Related examples in the same category