[Spec mistake] Is the `for` loop missing semicolon in the D Lang specification?

Paul Backus snarwin at gmail.com
Wed Aug 9 16:23:55 UTC 2023


On Wednesday, 9 August 2023 at 13:59:54 UTC, matheus wrote:
> Or maybe {} is treated different in this case, like a block and 
> there is an implicitly ";" being evaluated?

Yes, the {} is treated like a block statement, so it doesn't 
require a semicolon. Compare:


     import std.stdio;

     void main()
     {
         {
             writeln("Hello");
         } // <-- no semicolon
         writeln("World");
     }


More information about the Digitalmars-d mailing list