I have a function that adds elements from tree to a list recursively.
I would like to put the list initialization inside the implementation of the function (There's no good reason, just to understand how)
and pass the list argument as out parameter.
The thing is when I do it I get the error saying I must assign value, because I only initialize the list the first time if it is null the else condition doesn't have initialization.
How should I write it.
Here's the pseudo code:
public func(Tree root, out IList list)
if (root == null)
if (list == null)
list = new List();