Nested function |
A nested function is a function (programming) which can only be called from its parent function. That is, the scope (programming) of the nested function is limited to the current function only. For instance, D programming language supports nested functions:
int foo(int x) { int bar(int y) { return x + y; } return bar(3); }
In this case bar is a nested function for foo and can only be called from within foo.
Nested functions are useful for creating code blocks that must remain logically separate but are only useful for a specific function as opposed to the entire module or program.
= See also =
*Circular reference|
|