RosettaCodeData/Task/Higher-order-functions/D/higher-order-functions-1.d
2023-07-01 13:44:08 -04:00

9 lines
216 B
D

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));
}