in reply to fibonacci numbers using subroutine?
You are creating a recursive function so throw away your code, get a piece of paper, and write
then replace ... with an if/else structure that either returns a number, or adds the return value of a call to Fibonacci( $n ... ) ...it should follow closely the mathematical definition for Fibonacci number.sub Fibonacci { my $n = shift; ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fibonacci numbers using subroutine?
by alexbio (Monk) on Aug 20, 2010 at 10:35 UTC | |
by JavaFan (Canon) on Aug 20, 2010 at 12:59 UTC | |
by alexbio (Monk) on Aug 20, 2010 at 21:17 UTC | |
by JavaFan (Canon) on Aug 20, 2010 at 22:10 UTC | |
by alexbio (Monk) on Aug 22, 2010 at 10:35 UTC |