Can i set up function type for structure's field?
I need something like:
type MyStruct struct {
Callback func(int)
}
Thank you
Can i set up function type for structure's field?
I need something like:
type MyStruct struct {
Callback func(int)
}
Thank you
Yes, functions are first class things in Go. You can declare a function type anywhere you could put any other basic type like an integer.