Created
October 23, 2014 08:36
-
-
Save tgautier/6a9f6a65543c8b828590 to your computer and use it in GitHub Desktop.
Faker method to illustrate blocks @lewagon
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 fake_complexity(number) | |
puts "Launching very smart computation with the most clever algorithm...." | |
sleep(1) | |
puts ".." | |
sleep(1) | |
puts "...." | |
sleep(1) | |
puts "......." | |
result = yield(number, 4) | |
puts "Pfiou... That was some hard mathematics.." | |
return result | |
end | |
sum = fake_complexity(6) do |num, factor| | |
num * factor | |
end | |
puts sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment