Skip to content

Instantly share code, notes, and snippets.

@kkchu791
Created November 18, 2015 01:09
Show Gist options
  • Save kkchu791/d2d1205bf668e9516484 to your computer and use it in GitHub Desktop.
Save kkchu791/d2d1205bf668e9516484 to your computer and use it in GitHub Desktop.
def odd_or_even(array)
array.each do |num|
puts num % 2 == 0 ? "#{num}=even" : "#{num}=odd"
end
end
collection = [12, 23, 456, 123, 4579]
odd_or_even(collection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment