Welcome Guest!
 Open Euphoria
 Previous Message All Messages Next Message 
Parameter defaults  Pete Lomax
 Oct 10, 2005 13:26 PDT 

Seeing if this list is still working...

Let's say we allow optional parameters (by giving them defaults), eg:

function scan(object set, object target=0)
static integer k
k = compare(set[1],target)
if k=0 then
return set[RRES]
elsif k<0 then
return scan(set[LEFT])
else
return scan(set[RIGHT])
end if
end function

Now, in the example I have shown, I have given target a default of 0
so if the routine is called from toplevel with one parameter it will
find a 0. I have also shown the recursive calls don't bother passing
target again, implying the default of 0 shown above is NOT applied to
recursive calls. Does this make sense, is this the right thing to do?

It may get very confusing for mutually recursive routines...

Regards,
Pete
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.