- Modifications to the parameter copy don't affect the caller except pointer, slice, map, function, channel
- A function declaration without a body indicate that the function is implemented in a language other than Go
- A function can have multiple return values, client can assign return value to a blank identifier to ignore
- Ex. data, _ = findData()
- Function can be assigned to variable
- Zero value of function is nil
- Can use == to compare function (can only check is function nil), but function is not comparable so can not be key in map
Ex. func a(){}; func b(){}; f=a; f(); f+b; f()
Ex. func d(s string) {}; f=d; // compile error
沒有留言:
張貼留言