What does yield do? | Sololearn: Learn to code for FREE!
+ 1

What does yield do?

21st Jul 2016, 9:59 AM
Lunu'anaki
Lunu'anaki - avatar
2 Antworten
+ 6
yield keyword is used for generators. yield will return a value but will not exit the loop. thus, you can continuously return a value even if the loop is an infinite loop.
25th Jul 2016, 7:02 PM
akshil
akshil - avatar
+ 3
with the help of yield we can create code that will require less memory for their execution I.e. for lower models of PC. As yield runs one at a time for particular sections.
16th Aug 2016, 4:47 AM
Aman singh
Aman singh - avatar