Ad
  • Custom User Avatar

    The +1 is acting as a counter for the times it is neccessary to apply the logic until you reach the condition, the inputed number becoming only one digit.
    When that happens, the function returns 0 instead of calling itself again.
    Then, it adds one for everytime it "goes up" the recursive ladder, returning the number of times it called itself because the number was still not a single-digit.