Ad
  • Custom User Avatar

    You initialize the depth variable in the loop but reuse it outside the loop.
    It work for this exercise in this language but in some language the variable would stop existing after exiting the loop.
    For avoid this kind of error, it may be more wise to initialize your depth variable before the loop.