anonymous function/deleget usage

Joel Christensen joelcnz at gmail.com
Thu Nov 12 04:19:29 PST 2009


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.

int a=1;
int b=2;
int add(int a,int b) {
   return a+b;
}
int c=add(a,b);
writefln("Result:%d",c);

Nested functions are cool. :-)


More information about the Digitalmars-d-learn mailing list