1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00
anselme/test/tests/function scoped mutable.ans

40 lines
330 B
Text

:n = 0
$ f(c=1)
:a = []
start: {a}
~ a!insert(c)
~ n += 1
before recursion {c}: {a}
~ n < 5
~ f(c+1)
after recursion {c}: {a}
new list each time:
~ f
$ g(c=1, a=[])
start: {a}
~ a!insert(c)
~ n += 1
before recursion {c}: {a}
~ n < 5
~ g(c+1, a)
after recursion {c}: {a}
pass list:
~ n := 0
~ g