Skip to content

Instantly share code, notes, and snippets.

@gabrie30
Created October 4, 2014 22:47
Show Gist options
  • Save gabrie30/221bdb643d216677ad56 to your computer and use it in GitHub Desktop.
Save gabrie30/221bdb643d216677ad56 to your computer and use it in GitHub Desktop.
my_array = %w{10 56 93 97 122 92 3 49 588 422 18}
highest_number = 0
my_array.each do |number|
number = number.to_i
highest_number = number if number > highest_number
end
puts highest_number
p my_array.max # => "97" ? i would assome this returns 588
p my_array.min # => "10" ? i would assume this returns 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment