fork download
  1. import std.stdio;
  2.  
  3. void call(int function() func, int count) {
  4. for(int i = 0 ; i < count ; i++) {
  5. writeln(func());
  6. }
  7. }
  8.  
  9. int main() {
  10. int i = 0;
  11. int counter() {
  12. return i += 10;
  13. }
  14. call(counter, 10);
  15. return 0;
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.d(14): Error: function prog.call (int function() func, int count) is not callable using argument types (int,int)
prog.d(14): Error: cannot implicitly convert expression (counter()) of type int to int function()
stdout
Standard output is empty