Testing in Go

This commit is contained in:
Oliver Davies 2025-08-05 07:27:29 +01:00
parent 06a7e9a858
commit 55b8428d2a
3 changed files with 61 additions and 2 deletions

View file

@ -2,6 +2,28 @@ package main
import "fmt"
func main() {
fmt.Println("Hello, World")
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", ""))
}