Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyGomethods on typesSingle-choice MCQ

Can you call a method via a method value, like below, and what does it print?

package main import "fmt" type Greeter struct{ name string } func (g Greeter) Hello() string { return "hi " + g.name } func main() { g := Greeter{name: "Sam"} f := g.Hello g.name = "Pat" fmt.Println(f()) }