Skip to content

Instantly share code, notes, and snippets.

@jrfondren
Created May 6, 2019 11:58
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 jrfondren/aa3163e33ebe8a3d3fc4be01b8adcaf8 to your computer and use it in GitHub Desktop.
Save jrfondren/aa3163e33ebe8a3d3fc4be01b8adcaf8 to your computer and use it in GitHub Desktop.
iterator abc: int =
defer:
echo "abc cleanup"
yield 1
yield 2
yield 3
for x in abc():
echo x
if x == 2:
raise newException(ValueError, "don't know how to count to 'many'")
1
2
abc cleanup
itertest.nim(11) itertest
Error: unhandled exception: don't know how to count to 'many' [ValueError]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment