Files
Nim/tests/vm/tnewseqofcap.nim
ringabout 3dbf2ac946 remove echo statements in tests (part 1) (#20178)
* remove echo statements

* Update tests/vm/triangle_array.nim

* Update tests/vm/tyaytypedesc.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-08-23 19:28:51 +02:00

14 lines
305 B
Nim

const
foo = @["aaa", "bbb", "ccc"]
proc myTuple: tuple[n: int, bar: seq[string]] =
result.n = 42
result.bar = newSeqOfCap[string](foo.len)
for f in foo:
result.bar.add(f)
# It works if you change the below `const` to `let`
const
(n, bar) = myTuple()
doAssert bar == @["aaa", "bbb", "ccc"]