• @MagicShel@programming.dev
    link
    fedilink
    4
    edit-2
    7 months ago

    I haven’t contemplated this question before so my answer may be incomplete or incorrect, and I’ve also had like two double scotches, but I feel like the answer is when something is iterative, you can have a job half done and know when it is. For example adding a field to every object in a list has a definite midpoint whether you calculate it or not.

    Recursion is for things that are either 100% done or not done at all. In other words until you determine all the elements, you can’t and haven’t done anything. For example, parsing that includes matched brackets. You can’t possibly know anything until you’ve found the last bracket.