I implemented a recursive function within which I create an empty list. At the end of every recursion, I push the result (i.e. `visited`

) onto the list but as soon as the recursion begins, I have an empty list. I’m able to print the output (i.e. `visited`

) onto the terminal without any problems but I want the function to return the output of all the recursions as a list. Can you please help me with this?

Thanks

```
function RecDFS(genericgraph, visited, sink)
""" Reads in a generic graph and a source-destination pair and prints an
exhaustive list of paths using the Depth-first search (DFS) Technique """
############################################################################
# Credit: team17@stackoverflow.com
nodes = LightGraphs.neighbors(genericgraph, visited[length(visited)]) # Returns neighbour nodes
pathList = []
for i in nodes
if i == sink
push!(visited, i)
println(visited) # The accumulated paths are printed out iteratively
push!(pathList, visited)
pop!(visited)
elseif !in(i, visited)
push!(visited, i)
RecDFS(genericgraph, visited, sink) # Recursion starts here
pop!(visited)
end
end
return pathList
end
```