Two pictures to make sense of recursive functions (to golang for example)

 Recursive functions to comply with the principles of:

  • When a function is executed, it is necessary to create a new independent space protected (new function stack)
  • Local variables are independent and do not affect each other;
  • Recursive must exit the recursive approach to the conditions, otherwise it will be an infinite recursion;
  • When a function is finished, or encountered return, will return, observe who called the results will return to whom;

Guess you like

Origin www.cnblogs.com/xiximayou/p/11874139.html