Hi,
How can I make counter variable in function foo reference to global counter
variable in the following code. Generally C programmers tend to write code like
that I am looking for simple way to do it in python.
--- BEGIN ---
counter = 0
def foo():
if counter < 10:
print "count = ", counter
counter += 1
foo()
--- END ---
regards,
Subhash
--
Remove "nospam_" for direct reply
How can I make counter variable in function foo reference to global counter
variable in the following code. Generally C programmers tend to write code like
that I am looking for simple way to do it in python.
--- BEGIN ---
counter = 0
def foo():
if counter < 10:
print "count = ", counter
counter += 1
foo()
--- END ---
regards,
Subhash
--
Remove "nospam_" for direct reply
Comment