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

20 lines
414 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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()