3 ms·
> Go only allows named global functions, and lacks a feature that Pascal had. func main() { bar := func() { fmt.Println("Hello, 世界") }
by koenigdavidmj 15y ago
> Go only allows named global functions, and lacks a feature that Pascal had.
func main() {
bar := func() {
fmt.Println("Hello, 世界")
}
bar()
}
What do I lose by doing that versus having 'func bar()'?
- a_strange_guy 15y agothis: func global(some_arg_to_close_over Bar) { func walk_tree(node Node) { ... walk_tree(left(node)) walk_tree(right(node)) } walk_tree(something) }