Skip to content

Instantly share code, notes, and snippets.

@morimori
Last active December 12, 2015 01:18
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 morimori/4689823 to your computer and use it in GitHub Desktop.
Save morimori/4689823 to your computer and use it in GitHub Desktop.
再帰と retry の比較
def a(i = 0)
print 0x08.chr * i.to_s.size; print i
raise if i < 100000
rescue
i += 1
retry
end
def b(i = 0)
print 0x08.chr * i.to_s.size; print i
raise if i < 100000
rescue
b i + 1
end
a; puts
b; puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment