Iterators let you produce a sequence of values lazily, one at a time, using the yield keyword — without building the whole collection in memory. A method using yield return becomes an iterator that generates values on demand, ideal for large or infinite sequences and custom iteration.
yield return — lazy sequence generation
{
( i = ; i < n; i++)
{
i;
}
}
(
{
Console.WriteLine(num);
(num > ) ;
}
