tarraycons.nim 341 B

12345678910111213141516171819202122232425
  1. discard """
  2. file: "tarraycons.nim"
  3. line: 14
  4. errormsg: "invalid order in array constructor"
  5. """
  6. type
  7. TEnum = enum
  8. eA, eB, eC, eD, eE, eF
  9. const
  10. myMapping: array[TEnum, array[0..1, int]] = [
  11. eA: [1, 2],
  12. eC: [3, 4],
  13. eB: [5, 6],
  14. eD: [0: 8, 1: 9],
  15. eE: [0: 8, 9],
  16. eF: [2, 1: 9]
  17. ]
  18. echo myMapping[eC][1]