Skip to content

Instantly share code, notes, and snippets.

@benolee
Created August 31, 2011 20:26
Show Gist options
  • Save benolee/1184624 to your computer and use it in GitHub Desktop.
Save benolee/1184624 to your computer and use it in GitHub Desktop.
# I want this method in ruby-core
def let
yield
end
def fib(i)
let do |n = 1, result = 0|
if i == -1
result
else
i, n, result = i - 1, n + result, n
redo
end
end
end
puts fib(10) #=> 89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment