resultaccept.nim 571 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. output: ""
  3. """
  4. # Page 35.
  5. proc implicit: string =
  6. "I will be returned"
  7. proc discarded: string =
  8. discard "I will not be returned"
  9. proc explicit: string =
  10. return "I will be returned"
  11. proc resultVar: string =
  12. result = "I will be returned"
  13. proc resultVar2: string =
  14. result = ""
  15. result.add("I will be ")
  16. result.add("returned")
  17. doAssert implicit() == "I will be returned"
  18. doAssert discarded().len == 0
  19. doAssert explicit() == "I will be returned"
  20. doAssert resultVar() == "I will be returned"
  21. doAssert resultVar2() == "I will be returned"