summary refs log tree commit diff stats
path: root/tests/niminaction/Chapter2/resultaccept.nim
blob: 7dd976b40e8a73ddaf6c622d899b492885dccb59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
discard """
  output: ""
"""

# Page 35.

proc implicit: string =
  "I will be returned"
  
proc discarded: string =
  discard "I will not be returned"
  
proc explicit: string =
  return "I will be returned"

proc resultVar: string =
  result = "I will be returned"
  
proc resultVar2: string =
  result = ""
  result.add("I will be "
"p">() == "I will be returned" doAssert discarded() == nil doAssert explicit() == "I will be returned" doAssert resultVar() == "I will be returned" doAssert resultVar2() == "I will be returned"