type Test struct {
a int
b int
}
func f(a, b int) (int, int) {
return a, b
}
k := Test{(f(5, 6))} // Error
but
type Test struct {
a int
}
func f(a int) int {
return a
}
k := Test{(f(5))} // Ok
How send func result to struct fields, or create method for group of types,
example –> func(int,int) f (something) something {}
New contributor
Сергей Ковальчук is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.