Subj : Re: Are recursive functions ever needed? To : comp.programming From : Mabden Date : Sun Oct 02 2005 02:17 pm "Tatu Portin" wrote in message news:S6v%e.208$nZ1.35@read3.inet.fi... > Are recursive functions ever needed, i.e. cannot you just replace them > with iterative clauses? > > Example: > > b = func (func (func (a))) > > compared to: > > b = a; > for (i = 0; i < 3; i++) > { > b = func (b); > } Ah. Homework or a Troll. Why think, when you can ask others to think for you?! One day you may become a politician. Are cars necessary? We have bicycles and horses and jet planes... Recursion simplifies some tasks that can be a nightmare if you use looping. But it takes a lot of memory because each call has to store the previous results on the stack. Programming == trade-offs. You will need to learn the what - why - how YOURSELF to make those decisions that keep you employed. -- Mabden .