mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
18 lines
243 B
Nim
18 lines
243 B
Nim
# This is a sample code, the first echo statement prints out the error
|
|
type
|
|
A = object
|
|
case w: uint8
|
|
of 1:
|
|
n: int
|
|
else:
|
|
other: string
|
|
|
|
const
|
|
a = A(w: 1, n: 5)
|
|
|
|
proc foo =
|
|
|
|
let c = [a]
|
|
doAssert c[0].n == 5
|
|
|
|
foo() |