package main import ( "fmt" ) const ( english = "English" spanish = "Spanish" englishHelloPrefix = "Hello " spanishHelloPrefix = "Hola " englishDefaultWorld = "world" spanishDefaultWorld = "Mundo" ) func getDefaultWorldByLanguage(language string) string { switch language { case english: return englishDefaultWorld case spanish: return spanishDefaultWorld } return englishDefaultWorld } func getHelloPrefixByLanguage(language string) string { switch language { case english: return englishHelloPrefix case spanish: return spanishHelloPrefix } return englishHelloPrefix } func Hello(name, language string) string { prefix := getHelloPrefixByLanguage(language) if name == "" { return prefix + getDefaultWorldByLanguage(language) } return prefix + name } func main() { fmt.Println(Hello("Mary", "English")) }