exercism/go/bob/bob.go
2016-08-13 18:20:14 -05:00

20 lines
415 B
Go

package bob
import "strings"
// TestVersion is an exercism thing
const TestVersion = 1
// Hey provokes a response from Bob
func Hey(inp string) string {
inp = strings.TrimSpace(inp)
if inp == "" {
return "Fine. Be that way!"
} else if inp == strings.ToUpper(inp) && inp != strings.ToLower(inp) {
return "Whoa, chill out!"
} else if strings.HasSuffix(inp, "?") {
return "Sure."
}
return "Whatever."
}