Refactor: extract greetingPrefix function
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
Oliver Davies 2022-01-27 00:22:20 +00:00
parent 26706e014d
commit 4b865f379b

View file

@ -11,13 +11,17 @@ func Hello(name string, language string) string {
name = "World" name = "World"
} }
prefix := englishHelloPrefix return greetingPrefix(language) + name
}
func greetingPrefix(language string) (prefix string) {
prefix = englishHelloPrefix
if language == welsh { if language == welsh {
prefix = welshHelloPrefix prefix = welshHelloPrefix
} }
return prefix + name return
} }
func main() { func main() {