The while Loop : while « Statement « Ruby
- Ruby
- Statement
- while
The while Loop
i = 0
breeds = [ "q", "ar", "ap", "p" ]
puts breeds.size # => 4
temp = []
while i < breeds.size do
temp << breeds[i].capitalize
i +=1
end
temp.sort!
breeds.replace( temp )
p breeds
Related examples in the same category