How to use the yield statement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use the yield statement?

18th Nov 2018, 12:03 PM
Tarek Issaoui
3 Answers
18th Nov 2018, 12:27 PM
Kishalaya Saha
Kishalaya Saha - avatar
+ 3
Yield is somewhat then same as return. You use return when you expect one value back from your function. And yield when you are expecting a number of values back.
18th Nov 2018, 12:35 PM
Paul
Paul - avatar