m Wrote:
> Can a function return a function as a return value?
> as a delegate?
Yes, you can do those things. In D2 you can return a clusure too:
import std.stdio: writeln;
auto adder(int x) {
return (int y) { return x + y; };
}
void main() {
auto adder5 = adder(5);
writeln(adder5(3)); // prints 8
}
Bye,
bearophile