Created
July 17, 2023 08:32
-
-
Save rabestro/79f86e7786d53260e288386be5496bdc to your computer and use it in GitHub Desktop.
Bob - AI implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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