Yield is a contextual keyword available only in certain contextual statements, mainly interacts with the foreach loop. It allows each iteration in a foreach loop to be generated only when needed. In this way it improves the performance of the query.
Today we will discuss about it with a small funny code. Let’s see how much we actually know about this keyword. If you can answer the output of the code, you already know about it.