tret_arg_init.nim 302 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. output: '''
  3. '''
  4. """
  5. type Bar = object
  6. s1, s2: string
  7. proc initBar(): Bar = discard
  8. var a: array[5, Bar]
  9. a[0].s1 = "hey"
  10. a[0] = initBar()
  11. echo a[0].s1
  12. type Foo = object
  13. b: Bar
  14. var f: Foo
  15. f.b.s1 = "hi"
  16. f.b = initBar()
  17. echo f.b.s1
  18. var ad = addr f.b
  19. ad[] = initBar()
  20. echo ad[].s1