Generators - fixed counter
examples/generators/generator_counter_3.py
def counter(): n = 1 yield n n += 1 yield n n += 1 yield n for c in counter(): print(c)
1 2 3
def counter(): n = 1 yield n n += 1 yield n n += 1 yield n for c in counter(): print(c)
1 2 3