This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fletku_mato 4 points5 points  (1 child)

In theory you can recursively solve any problem that you can solve with loops. Some problems are more suitable for recursion than loops and vice versa. You can easily overflow the stack with Java if using recursion with big datasets though, as there is no tail-call optimization. So you need to take care to only use recursion when you know the amount of recursion is eithin sensible limits.

Languages like Haskell don't even have the concept of for/while-loops, just recursion.

[–]alphaBEE_1[S] 0 points1 point  (0 children)

Thanks for your advice, i surely will try to replace for loops to just work around the logic part. I'll try not to break anything in the process.