<div class="gmail_quote">On Mon, Nov 30, 2009 at 4:06 AM, ALAN GAULD <span dir="ltr">&lt;<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><br></div><div>Thats what I think is meant by bad practice in returning </div><div>multiple values. The function returns two completely different </div><div>things depending on some input flag.</div></blockquote></div>

<div><br></div>Now that&#39;s something I definitely agree with! I can&#39;t think of a single case where that would make sense or be good practice. It would just create a ton more work for the programmer/maintainer and obfuscate the code.<div>

<br></div><div>OTOH I can think of several reasons/times I&#39;ve returned multiple related values - for instance I was just writing a function for homework that found the continuous subsequence with the greatest total that returned the start, end, and total (more for my benefit than any other requirement... still, in terms of time complexity and program complexity, it makes much more sense than trying to break it up as &quot;getMaxTotal&quot; &quot;getstart&quot; and &quot;getend&quot; functions - that would just be ridiculous!)</div>

<div><br></div><div>-Wayne<br><br clear="all"><br>-- <br>To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn’t. - Primo Levi<br>


</div>