Nested function: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(Add Ecstasy example)
Line 522: Line 522:
=={{header|Delphi}}==
=={{header|Delphi}}==
''See [[#Pascal|Pascal]]''
''See [[#Pascal|Pascal]]''

=={{header|Ecstasy}}==
<syntaxhighlight lang="java">
module NestedFunction
{
static String makeList(String separator)
{
Int counter = 1;

function String(String) makeItem = item -> $"{counter++}{separator}{item}\n";

return makeItem("first")
+ makeItem("second")
+ makeItem("third");
}

void run()
{
@Inject Console console;
console.println(makeList(". "));
}
}
</syntaxhighlight>

Output:
<syntaxhighlight>
1. first
2. second
3. third
</syntaxhighlight>


=={{header|Elena}}==
=={{header|Elena}}==