summary refs log tree commit diff stats
path: root/tests/casestmt/tcase_setconstr.nim
blob: 21f657c2b080535ca54b41c27d217df36598f24c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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")