Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save harrisonmalone/a5668911a76666253dda75907fd114d7 to your computer and use it in GitHub Desktop.
Save harrisonmalone/a5668911a76666253dda75907fd114d7 to your computer and use it in GitHub Desktop.
def divisible_by_five(num)
num % 5 == 0
end
p divisible_by_five(4)
def divisible_by_five_multiple(array_of_numbers)
divisible_by_five_array = []
not_divisible_by_five_array = []
array_of_numbers.each do |num|
if divisible_by_five(num)
divisible_by_five_array << num
else
not_divisible_by_five_array << num
end
end
return [divisible_by_five_array, not_divisible_by_five_array]
end
p divisible_by_five_multiple([9,4,25,3,5,30,2,8,10,100])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment