= Nested Functions = ''Part of'' TutorialFundamentals == Description == Nested functions allows you to structure functions in a clever way if that's how your mind works. == Example == {{{ #!d import std.stdio; int main(char[][] Args) { int i; void runIt() { /* This is a nested function. You can make use of variables declared in the outer function, but each has to be declared above the location of the nested function if you use it.*/ writef("%d\tdo something\t", i); } bool found; while (!found) { if(i == 0) { writef("not found\t"); runIt(); return 0; } found = true; } return 0; } }}} == Testing == Tested using Digital Mars D Compiler v1.026 on Windows 2000. == More Information == See also the [http://www.digitalmars.com/d/1.0/function.html#nested D Specification].