zoukankan      html  css  js  c++  java
  • 函数的嵌套调用

    def testB():
        print ('---- testB start----')
        print ('这里是testB函数执行的代码...(省略)...')
        print ('---- testB end----')
    def testA():
        print ('---- testA start----')
        testB()
        print ('---- testA end----')
    testA()
    

     运行结果:

    ---- testA start----
    ---- testB start----
    这里是testB函数执行的代码...(省略)...
    ---- testB end----
    ---- testA end----

    小总结:

    • 一个函数里面又调用了另外一个函数,这就是所谓的函数嵌套调用 
    • 如果函数A中,调用了另外一个函数B,那么先把函数B中的任务都执行完毕之后才会回到上次 函数A执行的位置
  • 相关阅读:
    代码大全2阅读笔记之最后总结
    web商品系统最终版
    web商品系统
    期末总结
    2020/12/13
    2020/12/12
    2020/12/11
    2020/12/10
    2020/12/09
    2020/12/08
  • 原文地址:https://www.cnblogs.com/loaderman/p/6559272.html
Copyright © 2011-2022 走看看