Skip to content

Instantly share code, notes, and snippets.

@zacharycarter
Created August 20, 2017 12:38
Show Gist options
  • Save zacharycarter/7d000d264ff01461199b43c451b4816f to your computer and use it in GitHub Desktop.
Save zacharycarter/7d000d264ff01461199b43c451b4816f to your computer and use it in GitHub Desktop.
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