tenumoffset.nim 424 B

1234567891011121314151617181920
  1. discard """
  2. output: "my value A1my value Bconc2valueCabc4abc"
  3. """
  4. const
  5. strValB = "my value B"
  6. type
  7. TMyEnum = enum
  8. valueA = (1, "my value A"),
  9. valueB = strValB & "conc",
  10. valueC,
  11. valueD = (4, "abc")
  12. proc getValue(i:int): TMyEnum = TMyEnum(i)
  13. # trick the optimizer with a variable:
  14. var x = getValue(4)
  15. echo getValue(1), ord(valueA), getValue(2), ord(valueB), getValue(3), getValue(4), ord(valueD), x