Is it true that a closure is created in the following cases for foo, but not for bar?
foo
bar
Case 1:
closure bar will exist until foo returns, and the closure bar will then be garbage collected, since there is no reference to it at all anywhere
Yes.