Skip to content

Instantly share code, notes, and snippets.

@Osagiede

Osagiede/ruby.rb Secret

Created October 13, 2016 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Osagiede/b4b927de9f6366b392536611082fcdda to your computer and use it in GitHub Desktop.
Save Osagiede/b4b927de9f6366b392536611082fcdda to your computer and use it in GitHub Desktop.
assignment
# 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