Breaking ";" rule with lambda functions

ag0aep6g anonymous at example.com
Mon Aug 1 14:46:33 UTC 2022


On Monday, 1 August 2022 at 14:39:17 UTC, pascal111 wrote:
> On Monday, 1 August 2022 at 14:34:45 UTC, ag0aep6g wrote:
[...]
>> `a => a > 0` is not a statement. It's an expression.
>
> But it is still a "function", and functions make statements!! 
> It's not a normal expression.

It's a normal expression.

`foo => bar` is an expression that doesn't involve any statement. 
So there's no semicolon.

`(foo) { return bar; }` does contain a return statement. As you 
expect, there's a semicolon. But it's still an expression like 
any other.


More information about the Digitalmars-d-learn mailing list