by whileonebegin · 14y ago · 0 comments
ETA: I'm amused by how easily the LISP philosophy applies here: any problem can be solved with enough lambdas.
Then your choices include a try...finally block, a "using" statement if you're in c#, or ... limiting yourself to only 1 return. Multiple returns don't fix the problems in all cases, just most of them.
I'm assuming that this is on a language that has automatic garbage collection. The 1-return rule came about in C, which does not and so has a lot more cases where manual clean-up is required.