Move from learn-go-with-tests

Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-09-25 12:00:00 +01:00
parent 18bde5d382
commit b7c3fffbaa
10 changed files with 213 additions and 0 deletions

View file

@ -0,0 +1,29 @@
package main
import "fmt"
const englishHelloPrefix = "Hello, "
const welsh = "Welsh"
const welshHelloPrefix = "Helo, "
func Hello(name string, language string) string {
if name == "" {
name = "World"
}
return greetingPrefix(language) + name
}
func greetingPrefix(language string) (prefix string) {
prefix = englishHelloPrefix
if language == welsh {
prefix = welshHelloPrefix
}
return
}
func main() {
fmt.Println(Hello("Oliver", ""))
}