mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 09:54:49 +00:00
16 lines
265 B
Nim
16 lines
265 B
Nim
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")
|
|
|