Optional arguments/parameters

Namespace via Digitalmars-d digitalmars-d at puremagic.com
Wed May 28 04:57:50 PDT 2014


On Wednesday, 28 May 2014 at 11:54:30 UTC, Wanderer wrote:
> Java misses this feature badly, forcing programmers to 
> copy-paste bloated code (constructor A calls constructor B with 
> fewer arguments, constructor B calls constructor C etc, same 
> thing with methods). Please tell me, does D support this 
> feature?
>
> int myNiceFunc(double a, double b=0, int c=0) {...}
>
> auto n = myNiceFunc(100);

Default parameters? Of course. Every good language does that. :)


More information about the Digitalmars-d mailing list