20 lines
415 B
Go
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."
|
|
}
|