Inner function definition : Function Inner « Function « Python






Inner function definition

Inner function definition
def f1():
    x = 88
    def f2():
        print x
    f2()

f1()                  # prints 88




           
       








Related examples in the same category

1.Define and call a function inside another functionDefine and call a function inside another function
2.Use lambda to define inner functionUse lambda to define inner function
3.Nested function: 3 levelsNested function: 3 levels