On 10/16/20 4:47 PM, wilcro wrote:


Thanks to all for your responses; as a related followup question, would there be any reason to avoid placing the majority of code for a program outside of the main function?

Inner functions have benefits:

1. They are only accessible inside the function. Which means you only have to worry about correctness while INSIDE that function.
2. inner functions have access to the outer function's stack frame.

Often, I use inner functions to factor out a common piece of code that I don't want to have to write multiple times in the same function.

-Steve

Reply via email to