Skip to content

Instantly share code, notes, and snippets.

@JackInTaiwan
Created November 21, 2018 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JackInTaiwan/02f94193fe615a8bd099440e3bcfb591 to your computer and use it in GitHub Desktop.
Save JackInTaiwan/02f94193fe615a8bd099440e3bcfb591 to your computer and use it in GitHub Desktop.
global x
x = 10
def add_x():
x = x + 1
if __name__ == "__main__":
add_x()
# > UnboundLocalError: local variable 'x' referenced before assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment