tenumnegkey.nim 328 B

12345678910111213
  1. discard """
  2. output: "first-12second32third64"
  3. """
  4. type Holed = enum
  5. hFirst = (-12,"first")
  6. hSecond = (32,"second")
  7. hThird = (64,"third")
  8. var x = @[-12,32,64] # This is just to avoid the compiler inlining the value of the enum
  9. echo Holed(x[0]),ord Holed(x[0]),Holed(x[1]),ord Holed(x[1]),Holed(x[2]),ord Holed(x[2])