Closures

Wikipedia: Closure
Tengo supports anonymous functions, which can form closures. Closures are functions that "capture" variables from their outer scope.

fmt := import("fmt")
fmt.println(nextInt())
fmt.println(nextInt())
fmt.println(nextInt())

try it

1
2
3
1
loading…