tnamedenumfields.nim 406 B

123456789101112131415161718192021222324
  1. discard """
  2. file: "tnamedenumfields.nim"
  3. output: "my value A0my value Bconc1valueCabc3abc"
  4. """
  5. const
  6. strValB = "my value B"
  7. type
  8. TMyEnum = enum
  9. valueA = (0, "my value A"),
  10. valueB = strValB & "conc",
  11. valueC,
  12. valueD = (3, "abc"),
  13. valueE = 4
  14. # trick the optimizer with a variable:
  15. var x = valueD
  16. echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x