Default to the first message if name is empty

This commit is contained in:
Oliver Davies 2022-01-26 18:00:00 +00:00
parent 4c1fb0ec5a
commit 0f3e93e7d5
2 changed files with 13 additions and 0 deletions

View file

@ -5,6 +5,10 @@ import "fmt"
const englishHelloPrefix = "Hello, "
func Hello(name string) string {
if name == "" {
name = "World"
}
return englishHelloPrefix + name
}