$ ./guess_the_languageProgramming Languages
Programming Languages · medium · #406

Which programming language is this?

def counter():
    total = 0
    while True:
        total += yield total

Answer: Python

yield inside a def makes it a Python generator; the assignment form also receives sent values.
Play Programming Languages ▸