diff options
author | Araq <rumpf_a@web.de> | 2011-06-19 17:45:33 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-06-19 17:45:33 +0200 |
commit | 8b6f9ef5e8c1203ab7d84a727523723c068475ed (patch) | |
tree | 8b4d04f7a14b25274ded06bdd4ffc7749335aa81 /tests/accept/run | |
parent | 54021471e40d2cc2ff8f178192ba83873e7f43e0 (diff) | |
download | Nim-8b6f9ef5e8c1203ab7d84a727523723c068475ed.tar.gz |
case branches support constant sets for convenience
Diffstat (limited to 'tests/accept/run')
-rw-r--r-- | tests/accept/run/tcase_setconstr.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/accept/run/tcase_setconstr.nim b/tests/accept/run/tcase_setconstr.nim new file mode 100644 index 000000000..21f657c2b --- /dev/null +++ b/tests/accept/run/tcase_setconstr.nim @@ -0,0 +1,15 @@ +discard """ + output: "an identifier" +""" + +const + SymChars: set[char] = {'a'..'z', 'A'..'Z', '\x80'..'\xFF'} + +proc classify(s: string) = + case s[0] + of SymChars, '_': echo "an identifier" + of {'0'..'9'}: echo "a number" + else: echo "other" + +classify("Hurra") + |