Created
May 14, 2024 03:44
-
-
Save DrunkenAlcoholic/9d4bbfa866e6b62c926e89b551f920fe to your computer and use it in GitHub Desktop.
Bob [Exercism - Nim]
This file contains hidden or 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
import strutils, unicode | |
proc hey*(s: string): string = | |
if s == s.toUpperAscii and contains(s, Letters.set) and s[^1] == '?': | |
return "Calm down, I know what I'm doing!" | |
elif s == s.toUpperAscii and contains(s, Letters.set): | |
return "Whoa, chill out!" | |
elif not contains(s, {'A'..'Z', 'a'..'z', '0'..'9', '?'}) or s == nil: | |
return "Fine. Be that way!" | |
elif strutils.strip(s)[^1] == '?': | |
return "Sure." | |
else: return "Whatever." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment