Take for example,
The follow python code:
def multiples_of_2(): i = 0 while True: i = i + 2 yield i
How do we translate thi
int multiples_of_2() { static int i = 0; i += 2; return i; }
The static int i behaves like a global variable but is visible only within the contect of multiples_of_2().