Skip to content

Instantly share code, notes, and snippets.

@rabestro
Created July 17, 2023 08:32
Show Gist options
  • Save rabestro/79f86e7786d53260e288386be5496bdc to your computer and use it in GitHub Desktop.
Save rabestro/79f86e7786d53260e288386be5496bdc to your computer and use it in GitHub Desktop.
Bob - AI implementation
func Hey(remark string) string {
remark = strings.TrimSpace(remark)
if remark == "" {
return "Fine. Be that way!"
}
isQuestion := strings.HasSuffix(remark, "?")
isYelling := strings.ToUpper(remark) == remark && strings.ToLower(remark) != remark
switch {
case isQuestion && isYelling:
return "Calm down, I know what I'm doing!"
case isQuestion:
return "Sure."
case isYelling:
return "Whoa, chill out!"
default:
return "Whatever."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment