Debug help - static foreach - module scope - Programming in D page 603

Andy Valencia dont at spam.me
Thu Aug 28 13:16:26 UTC 2025


On Thursday, 28 August 2025 at 13:09:21 UTC, Brother Bill wrote:
> Unable to compile.  Please advise.
> ```
> c:\dev\D\81 - 
> 90\c83_e_static_foreach_fibonacci\source\app.d(8): Error: 
> function declaration without return type. (Note that 
> constructors are always named `this`)
>     writeln(n);

writeln() isn't valid at scope 0, which is where that static 
foreach is putting it.  I changed it to pragma(msg, n) and saw 
the expected sequence of numbers.

Andy



More information about the Digitalmars-d-learn mailing list