www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - 2 bool optional params

reply spir <denis.spir gmail.com> writes:
Hello,

Is there a way for a func to hold 2 optional params of the same type?
	void f(int p, bool b1=3Dfalse, bool b2=3Dfalse) {
	    writefln("p=3D%s b1=3D%s b2=3D%s", p,b1,b2);
	 }
Or is there a workaroud?

Denis
-- -- -- -- -- -- --
vit esse estrany =E2=98=A3

spir.wikidot.com
Nov 09 2010
parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
On Wed, 10 Nov 2010 08:55:26 +0100, spir wrote:

 Hello,
 
 Is there a way for a func to hold 2 optional params of the same type?
 	void f(int p, bool b1=false, bool b2=false) {
 	    writefln("p=%s b1=%s b2=%s", p,b1,b2);
 	 }
 Or is there a workaroud?
I'm not sure I understand what you're asking for here. Your example works for me. -Lars
Nov 10 2010
parent spir <denis.spir gmail.com> writes:
On Wed, 10 Nov 2010 08:54:20 +0000 (UTC)
"Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> wrote:

 On Wed, 10 Nov 2010 08:55:26 +0100, spir wrote:
=20
 Hello,
=20
 Is there a way for a func to hold 2 optional params of the same type?
 	void f(int p, bool b1=3Dfalse, bool b2=3Dfalse) {
 	    writefln("p=3D%s b1=3D%s b2=3D%s", p,b1,b2);
 	 }
 Or is there a workaroud?
=20 I'm not sure I understand what you're asking for here. Your example=20 works for me.
See answer to Jonathan; I should have insisted on "optional". Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Nov 10 2010