Semicolon?

deadalnix deadalnix at gmail.com
Tue May 11 16:31:34 UTC 2021


On Tuesday, 11 May 2021 at 15:41:02 UTC, Witold Baryluk wrote:
> On Wednesday, 31 March 2021 at 21:51:07 UTC, Arun wrote:
>> Just curious. Does the compiler need semicolon anymore? Are 
>> there corner cases that don't work without semicolon?
>
> Please never even considering semicolons to be optional in D. I 
> once hit a optional semicolon issue in JavaScript, that took 
> two weeks to debug. I hate that feature since then (~2005).
>
> If you don't want to use semicolons, just use Python-like 
> syntax, and then run it thour some converter for example.

function foo()
{
     return
     {
         foo: "bar"
     }
}

console.log(foo())

What does this log? "undefined", obviously, what did you expect?

I learned this the hard way too.


More information about the Digitalmars-d mailing list