How Nested Functions Work, part 1

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Sep 2 14:05:03 PDT 2009


On Wed, Sep 2, 2009 at 4:53 PM, Nick Sabalausky<a at a.a> wrote:
>> void foo(bool delegate() dg) {
>>    dg();
>> }
>> foo({return true;});
>>
>
> Sure, when there's no parameters (...does that work in D1, or just D2?...),
> but even then, I still always end up going though a process like this when
> defining foo:

No, you can do it with params too.

foo((int x) { return x; });



More information about the Digitalmars-d mailing list