Skip to content

Instantly share code, notes, and snippets.

@oelmekki
Created October 7, 2011 19:29
Show Gist options
  • Save oelmekki/1271162 to your computer and use it in GitHub Desktop.
Save oelmekki/1271162 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
array, places = [1,2,3,8,5,8,0,4], []
puts "Maximum value of array is #{array.max}"
array.each_with_index do |val,i|
places << i if val == array.max
end
puts "You can find #{array.max} in position #{places.join ', '}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment