Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Modifying Global Variable From Inside the Function

c = 1 # global variable
    
def add():
    c = c + 2 # increment c by 2
    print(c)

add()
 
PREVIOUS NEXT
Tagged: #Python #Modifying #Global #Variable #From #Inside #Function
ADD COMMENT
Topic
Name
9+5 =