Skip to content

Instantly share code, notes, and snippets.

@Araq
Created March 10, 2012 11:00
Show Gist options
  • Save Araq/2011157 to your computer and use it in GitHub Desktop.
Save Araq/2011157 to your computer and use it in GitHub Desktop.
closure issue
var funcs: seq[proc (): int {.closure.}] = @[]
proc main() =
var i = 0
while i <= 10:
funcs.add((proc (): int =
var x = i
return x * x))
inc i
main()
echo(funcs[3]())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment