Skip to content

Instantly share code, notes, and snippets.

@trickster
Created March 5, 2018 15:10
Show Gist options
  • Save trickster/058c37a752a7460acec96a4daeee4ee0 to your computer and use it in GitHub Desktop.
Save trickster/058c37a752a7460acec96a4daeee4ee0 to your computer and use it in GitHub Desktop.
Nim cases
case 'h':
of 'a', 'e', 'i', 'o', 'u':
echo "Vowel"
of '\127'..'\255':
echo "Unknown"
else:
echo "Consonant"
proc positiveOrNegative(num: int): string =
result = case num:
of low(int).. -1: # remember space between
"negative"
else:
"impossible"
echo positiveOrNegative(-1)
echo low(int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment