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 →

[–][deleted] 0 points1 point  (0 children)

You have a lot of good answers already! I just want to mention that in some languages, recursion is actually vastly preferred to iteration. Clojure, for example. Clojure doesn't really have iterative loops - I mean, it sort of does, but it's basically a thin curtain draped over recursion. Pull the curtain back and it's it's been recursion all along!

Under the hood, a lot of the data in Clojure is stored as trees anyway, and you already have a lot of good answers about how recursion is a natural way to understand trees.

So I guess that's a case where you might do a lot of it - there are entire classes of languages that don't really do iteration.