On 05/12/2015 04:36 PM, Robert Hanson wrote:
> Hmm, this looks good to me:
>
>
> show functions
> /*
>   * rectest
>   */
> function rectest (level){
>
>     print "level="+ level +" maxLevel=" + maxLevel + "\n";
>     if (level < maxLevel) {
>       print "recursing at level " + level+"\n";
>       recTest(level + 1);
>     } else {
>       print "recursion finished at level " + level+"\n";
>     }
> }
>
> recTest(1)
>
>
> level=1 maxLevel=5
>
> recursing at level 1
>
> level=2 maxLevel=5
>
> recursing at level 2
>
> level=3 maxLevel=5
>
> recursing at level 3
>
> level=4 maxLevel=5
>
> recursing at level 4
>
> level=5 maxLevel=5
>
> recursion finished at level 5
>
> recursion finished at level 4
>
> recursion finished at level 3
>
> recursion finished at level 2
>
> recursion finished at level 1
>
Bob, why does it look good to you?

It is ok that the 'rectest' function is called again four times.
But the 'else' branch should only be executed when level=maxlevel. And 
this should be the case only in the last 'rectest' call. Otherwise both 
branches of the 'if...else' would have been followed, which should never 
happen.

Regards,
Rolf
-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax:     +49 3641 65 6210
E-Mail:  rhue...@fli-leibniz.de
Website: http://www.fli-leibniz.de

           Scientific Director: Prof. Dr. K. Lenhard Rudolph
        Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to