Re: Recursion
- Posted by Derek Parnell <ddparnell at bigpond?com> Jul 22, 2007
- 536 views
don cole wrote: > -- this is iteration > --this is recursion > > Is this correct? Yes, but not something that people might actually do. This is iteration : function facti(int n) int res res = 1 for i = 2 to n do res *= i end for return res end function This is recursion : function factr(int n) if n <= 1 then return 1 end if return n * factr(n-1) end function -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell