Last active
September 24, 2018 06:29
-
-
Save harrisonmalone/a5668911a76666253dda75907fd114d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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