tenumitems2.nim 182 B

123456789101112131415
  1. discard """
  2. output: "A\nB\nC"
  3. """
  4. type TAlphabet = enum
  5. A, B, C
  6. iterator items(E: typedesc[enum]): E =
  7. for v in low(E)..high(E):
  8. yield v
  9. for c in TAlphabet:
  10. echo($c)