Problem about lambda expressions

Timon Gehr timon.gehr at gmx.ch
Wed Mar 28 08:34:18 PDT 2012


On 03/28/2012 01:13 PM, Tongzhou Li wrote:
> On Wednesday, 28 March 2012 at 10:17:15 UTC, Timon Gehr wrote:
>> On 03/28/2012 10:28 AM, Tongzhou Li wrote:
>>> On Wednesday, 28 March 2012 at 08:22:25 UTC, Tongzhou Li wrote:
>>>> I understood. But why it compiles instead of giving an error? What
>>>> does the complier do when I write the wrong code?
>>>
>>> Oh, I mean if I write the wrong code, what objectcode does the compiler
>>> generate?
>>> My English is not good, sorry.
>>
>> (int a) => {return a;}
>>
>> Is the same thing as
>>
>> (int a){return ()=>a;}
>
> I understand.
> { return a; }
> is a function which requires no params right?

Yes.


More information about the Digitalmars-d-learn mailing list