Created
March 5, 2018 15:10
-
-
Save trickster/058c37a752a7460acec96a4daeee4ee0 to your computer and use it in GitHub Desktop.
Nim cases
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
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