Types of lambda args

Adam D. Ruppe destructionator at gmail.com
Mon Aug 17 00:27:38 UTC 2020


On Monday, 17 August 2020 at 00:20:24 UTC, Cecil Ward wrote:
> In a lambda, how do we know what types the arguments are? In 
> something like
>     (x) => x * x

In that the compiler figures it out from usage context. So if you 
pass it to a int delegate(int), it will figure x must be int.

> - there I just don’t get it at all. Can you write
>     (uint x) => x * x

yeah you can always add more info if you like.


More information about the Digitalmars-d-learn mailing list