Default to the first message if name is empty
This commit is contained in:
parent
4c1fb0ec5a
commit
0f3e93e7d5
2 changed files with 13 additions and 0 deletions
4
hello.go
4
hello.go
|
@ -5,6 +5,10 @@ import "fmt"
|
|||
const englishHelloPrefix = "Hello, "
|
||||
|
||||
func Hello(name string) string {
|
||||
if name == "" {
|
||||
name = "World"
|
||||
}
|
||||
|
||||
return englishHelloPrefix + name
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue