Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.