diff --git a/content/case.md b/content/case.md index 5c9aa99..db8638a 100644 --- a/content/case.md +++ b/content/case.md @@ -48,4 +48,19 @@ $ nimrod c -r ./case_stmts.nim C Consonant negative +``` + +Another feature of sets is that when possible, the possible types are narrowed to a range so that the following code works without requiring an else statement. + +``` nimrod +let x = 2 +case (x and 3) + 7 +of 7: echo "A" +of 8: echo "B" +of 9: echo "C" +of 10: echo "D" +``` +``` console +$ nimrod c -r ./case_stmts_1.nim +C ``` \ No newline at end of file