20 lines
414 B
Text
20 lines
414 B
Text
|
|
V x = ‘From global scope’
|
|||
|
|
|
|||
|
|
F outerfunc()
|
|||
|
|
V x = ‘From scope at outerfunc’
|
|||
|
|
|
|||
|
|
F scoped_local()
|
|||
|
|
V x = ‘scope local’
|
|||
|
|
R ‘scoped_local scope gives x = ’x
|
|||
|
|
print(scoped_local())
|
|||
|
|
|
|||
|
|
F scoped_nonlocal()
|
|||
|
|
R ‘scoped_nonlocal scope gives x = ’@x
|
|||
|
|
print(scoped_nonlocal())
|
|||
|
|
|
|||
|
|
F scoped_global()
|
|||
|
|
R ‘scoped_global scope gives x = ’:x
|
|||
|
|
print(scoped_global())
|
|||
|
|
|
|||
|
|
outerfunc()
|