// Provides a Hello world example with tests
package main

import (
	"fmt"
)

// Constants can be grouped in a block.
// Add a line between related consts for
// readbility
const (
	french  = "French"
	spanish = "Spanish"

	englishHelloPrefix = "Hello, "
	spanishHelloPrefix = "Hola, "
	frenchHelloPrefix  = "Bonjour, "
)

// Hello prints the string "Hello, world"
func Hello(name string, language string) string {
	if name == "" {
		name = "World"
	}

	return greetingPrefix(language) + name
}

// greetingPrefix Using a named return value will initialize a "zero value"
// variable which as you can see below can be assigned to.
// this will display in Go Doc for your function.
// Lower case letter functions are "private" functions. They are internal to implementation.
func greetingPrefix(language string) (prefix string) {
	switch language {
	case french:
		prefix = frenchHelloPrefix
	case spanish:
		prefix = spanishHelloPrefix
	default:
		prefix = englishHelloPrefix
	}
	// we use names return value in function signature
	return

}

func main() {
	fmt.Println(Hello("world", ""))
}
