using System;
using System.Collections.Generic;
class Yield_CSharp
{
static void Main()
{
Console.WriteLine(string.Join(" ", PrintWhilePositive(new int[] {1, 2, 5, 7, -1, 9, 8})));
}
static IEnumerable<int> PrintWhilePositive(IEnumerable<int> numbers) {
foreach (int n in numbers) {
if (n > 0) {
yield return n;
}
else {
yield break;
}
}
}
}
/*
run:
1 2 5 7
*/