RosettaCodeData/Task/Higher-order-functions/D/higher-order-functions-1.d

10 lines
216 B
D
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
int hof(int a, int b, int delegate(int, int) f) {
return f(a, b);
}
void main() {
import std.stdio;
writeln("Add: ", hof(2, 3, (a, b) => a + b));
writeln("Multiply: ", hof(2, 3, (a, b) => a * b));
}