Created
August 20, 2017 12:38
-
-
Save zacharycarter/7d000d264ff01461199b43c451b4816f to your computer and use it in GitHub Desktop.
Snippet from https://play.nim-lang.org
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
proc season(month: range[1..12]): string = | |
case month | |
of 1, 2, 12: return "winter" | |
of 4, 5, 6: return "spring" | |
of 7, 8, 9: return "summer" | |
of 10, 11: return "autumn" | |
echo season(5) # in.nim(2, 3) Error: not all cases are covered |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment