Advertisements
Advertisements
प्रश्न
What is the purpose of the yield statement?
लघु उत्तर
Advertisements
उत्तर
The yield statement turns a function into a generator. It returns one value at a time, pauses execution, saves the function's state, and resumes from the same point during the next iteration or next() call. This saves memory because all results do not have to be stored at once.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
