Association between generators and yield | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Association between generators and yield

What is a generator function and what is its association with the yield function.

25th Mar 2017, 8:54 AM
Yashvardhan Shetty
Yashvardhan Shetty - avatar
2 Answers
+ 3
actually, a generator is a function that contains at least one yield statement
25th Mar 2017, 1:57 PM
Amaras A
Amaras A - avatar
0
The yield statement is used to define a generator, replacing the return of a function to provide a result to its caller without destroying local variables.
17th Nov 2017, 9:44 PM
Gunther Strauss
Gunther Strauss - avatar