[go-nuts] why defer function with parentheses

2018-01-27 Thread Tamás Gulácsi
Defer defers the esecutiin of the following expression, but not the evaluation of the arguments. So "defer fn(a==1)" will call fn when this function exists, with a bool that is true iff a _was_ 1 when the defer was registered. -- You received this message because you are subscribed to the Googl

[go-nuts] why defer function with parentheses

2018-01-27 Thread Flying
example : fn := func() { fmt.Println(10) } defer fn() my question is why use defer fn() not defer fn when we use fn() here doesn't it mean call it now ??? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and