-
-
Save krancour/164275b10e122c7ec18831c02fcbee2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type GreetingFn func(string) error | |
func SayGreetings(greetingFns []GreetingFn, name string) error { | |
for _, greetingFn := range greetingFns { | |
if err := greetingFn(name); err != nil { | |
return err | |
} | |
} | |
return nil | |
} | |
func main() { | |
SayGreetings( | |
[]GreetingFn{EnglishGreeting, SpanishGreeting}, | |
"World", | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment