method has no return statement with switch

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 6 20:25:26 PST 2015


On Saturday, 7 November 2015 at 00:21:57 UTC, crimaniak wrote:
> Hi!
>
> I have the error message:
> source/url.cache.d(20,16): Error: function 
> url.Cache.UrlCache.doRequest has no return statement, but is 
> expected to return a value of type string
>
> [...]

Because the "switch" is marked as "final", eventually one of 
cases will be followed. Because both cases have a "return" point, 
code will never get out of switch statement. So the compiler acts 
correctly.


More information about the Digitalmars-d-learn mailing list