Reply to post:

If you fire someone, don't let them hang around a month to finish code

Pascal Monett Silver badge

This kind of thing can still be necessary.

I like using recursive functions, whenever possible. It seems quite elegant to me, but I have learned that said elegance comes at a price.

For example, if you need to search and replace a given character in a string of characters (for export to csv reasons, for example), if you have to write your own s&r function for whatever reason, you'd better be sure that the original string isn't too long and that there aren't too many occurences.

Otherwise, your code will crash with a memory overflow error due to the amount of instances of the recursive function.

In that case, there's no choice but to deal with a loop function and handle everything in one instance.

It's a bummer, but it works.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon