I am new to Python.
How can I accomplish something like this:
def gameon():
currentNum = 0
for x in range(100):
currentNum+=1
otherfunc()
def otherfunc(maybe a possible parameter...):
for y in range(500):
#check for some condition is true and if it is...
#currentNumFROMgameon+=1
My actual code that used global variables:
def gameon():
global currentNum
currentNum = 0
for x in range(100):
currentNum+=1
otherfunc()
def otherfunc():
global currentNum
for y in range(500):
if(...):
currentNum+=1
global currentNum
How can I accomplish this(accessing and changing currentNum from otherfunc) without making currentNum global?
currentNumto the function and let the function return the modified version ofcurrentNum?