RosettaCodeData/Task/Scope-modifiers/11l/scope-modifiers.11l

20 lines
414 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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()