Nested function: Difference between revisions

Content added Content deleted
Line 849: Line 849:


=={{header|Tcl}}==
=={{header|Tcl}}==
The code below satisfies the specification (inspired by the Swift example). The inner function is defined, called, and then discarded by renaming to {}.
The code below satisfies the specification (inspired by the Swift example). The inner function MakeItem (which gains read/write access to its caller's variables via upvar) is defined, called, and then discarded by renaming to {}. suchenwi
<lang Tcl>
<lang Tcl>#!/usr/bin/env tclsh
#!/usr/bin/env tclsh


proc MakeList separator {
proc MakeList separator {