Error: cannot return non-void from void function
Suliman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Nov 27 09:22:35 PST 2014
> ah, that's it! as spec says, D determines function return value
> from
> the first 'return' statement it seen. in your case this is
> `return;`,
> so function return type is determined to be `void`.
>
> if you doing `auto` functions, try to arrange your code so the
> first
> `return` returning the actual value.
>
> besides, your code is wrong anyway, 'cause you can't have
> function that
> returns both "nothing" and "something". your first `return;`
> should
> either return something, or must be changed to throwing some
> exception.
How I can terminate program? First return I used to terminate app
if config file is exists.
More information about the Digitalmars-d-learn
mailing list