nimhcr_0_4.nim 464 B

1234567891011121314151617181920
  1. import hotcodereloading
  2. import nimhcr_1 # only importing 1
  3. let g_0 = 1000 # new value! but also a "new" global :)
  4. proc getInt*(): int = return g_0
  5. proc makeCounter*(): auto =
  6. return iterator: int {.closure.} =
  7. for i in countup(0, 10, 1):
  8. yield i
  9. let c = makeCounter()
  10. afterCodeReload:
  11. echo " 0: after - closure iterator! after reload! does it remember? :", c()
  12. echo " 0: after - closure iterator! after reload! does it remember? :", c()