tconstr2.nim 503 B

1234567891011121314151617181920212223
  1. discard """
  2. output: "69"
  3. """
  4. # Test array, record constructors
  5. type
  6. TComplexRecord = tuple[
  7. s: string,
  8. x, y: int,
  9. z: float,
  10. chars: set[char]]
  11. const
  12. things: array[0..1, TComplexRecord] = [
  13. (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
  14. (s: "hi", x: 69, y: 45, z: 1.0, chars: {})]
  15. otherThings = [ # the same
  16. (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
  17. (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
  18. writeLine(stdout, things[0].x)
  19. #OUT 69