On Thu, 12 Nov 2009 10:21:44 -0500, Don <[email protected]> wrote:
Sam Hu wrote:How can I reach something like below code: int a=1; int b=2; int c=(int a,int b){ return a+b;} writefln("Result:%d",c); Thanks in advance.You need to call the delegate you've made. int a=1; int b=2; int c=(int a,int b){ return a+b;}(a,b); writefln("Result:%d",c);}
Also, don't forget you can refer to variables in the enclosing function:
int c = (){return a + b;}();
-Steve
