<@U7TDJR3QU> You're adding the same `path` list ev...
# announcements
i
@melanchroes You're adding the same
path
list every time to the
results
list. Then you're mutating it, eventually clearing it.
m
Awesome, thx for the insight! So when we mutate a parameter like
path
(like I do at
path.add(step)
), a copy of that parameter is created that only exists with the scope of the function call?
Wait I read that wrong - I see whats happening here XD
All the entries in
results
point to a single reference of
path
thats eventually cleared like you said. Thanks!
e
Did you use (probably wrong but it works) results.add(path.toMutableList()) ?
Also you don't need to pass arguments as lists as you can set them up initially as having defaults in the parameters of the fun