On Tuesday, 27 March 2012 at 13:42:30 UTC, Tongzhou Li wrote:
Hello again! I'm learning D, and I encountered a problem.
I tried this code:
http://ideone.com/hkpT6
It works well. (Have no idea why codepad.org failed to compile it) I tried to write a lambda instead of function f, but I got nothing printed.
Did I make something wrong?
Compiler used: DMD32 D Compiler v2.058 (Win7 SP1 x64)
Sorry for my poor English :)

(obj x, int a0, int a1) => { x.setxxx(a0); x.setyyy(a1); }

This lambda expression returns *a delegate has no parameter*.
Instead:

(obj x, int a0, int a1) => (x.setxxx(a0), x.setyyy(a1))

or:

(obj x, int a0, int a1){ x.setxxx(a0); x.setyyy(a1); }

Reply via email to