Created
October 27, 2012 09:41
-
-
Save kennyt/3963777 to your computer and use it in GitHub Desktop.
05_silly_blocks
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
def reverser &proc | |
answer = [] | |
proc.call.split(' ').each do |word| | |
answer<<word.reverse | |
end | |
answer.join(' ') | |
end | |
def adder number=1, &proc | |
number + proc.call | |
end | |
def repeater number=1, &proc | |
number.times { proc.call } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment