--- In [email protected], Olufowobi Lawal <wolex...@...> wrote:
>
> So that left me wondering if recursion is in same category as "goto" , "know 
> it, but don't use it".
>  or are there some instance or some way where they can be used effeciently, 
> like in my case?

I don't think your case is a good candidate for recursion - I would say it is 
more logical to use a loop. 'Keep asking for input until input is valid' 
implies a loop to me.

However some problems can be described very concisely using recursive-like 
notation eg, Fibonachi and other mathematical stuff, and it might be that the 
recursive solution implementation is a lot clearer and more maintainable than 
the loop-base solution.

In which case, you have to decide which is more important - efficiency, or 
clarity/maintainability of design/code. On real-time embedded systems, 
efficiency is usually the overriding factor. On PCs, it might not be.

Reply via email to