return the other functions of the void main()

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 9 04:07:04 PDT 2015


On 9/04/2015 11:03 p.m., Dennis Ritchie wrote:
> Hi,
> Is it allowed in D similar designs?
>
> void main() {
>      import std.stdio;
>      return writeln("Hello, world!");
> }

Sure when:

import std.traits : ReturnType;
import std.stdio : writeln;

static assert(is(ReturnType!writeln == int));


More information about the Digitalmars-d-learn mailing list