• kalpol
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    3
    ·
    7 months ago

    This isn’t recursion

    • Maalus@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      2
      ·
      7 months ago

      To whoever goes by this comment, downvotes and thinks “yeah it is!” - you are wrong. It’s an endless loop, where a condition to exit it is never met. Recursion is calling on the same function and it slowly getting you the answer. I.e. the task is - ask 15 relatives. To ask the next relative, you first need to ask the one before it. And then you need to ask an even further n+1 relative, till you reach the 15th. So then you meet the condition for the 14th, till you ask person 1 and then you can go for ice cream.