-
-
Save Osagiede/b4b927de9f6366b392536611082fcdda to your computer and use it in GitHub Desktop.
assignment
This file contains 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
# Create a new proc that will print true is a number is even and false if it is odd. | |
# Yield this proc inside a method called is_it_even. | |
# This method should take both the yielded block and a number as arguments. | |
def is_it_even | |
yield | |
end | |
odd_or_even = Proc.new do |num| | |
if num.even? | |
puts "Even" | |
else | |
puts "False" | |
end | |
end | |
is_it_even(4) &odd_or_even |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment