exercism/go/bob/bob.go

20 lines
415 B
Go
Raw Normal View History

2016-08-13 23:20:14 +00:00
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."
}