Skip to content

Instantly share code, notes, and snippets.

@banister
Created February 2, 2011 09:00
Show Gist options
  • Save banister/807435 to your computer and use it in GitHub Desktop.
Save banister/807435 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