2004-02-05 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / tests / 2test-2.cs
1 using System;
2 using System.Collections;
3
4 class X {
5         static int start, end;
6         static int i;
7
8         static IEnumerator GetRange ()
9         {
10                 yield return 1;
11                 for (i = start; i < end; i++)
12                         yield return i;
13                 yield return 100;
14         }
15
16         static int Main ()
17         {
18                 start = 10;
19                 end = 30;
20
21                 int total = 0;
22                 
23                 IEnumerator e = GetRange ();
24                 while (e.MoveNext ()){
25                         Console.WriteLine ("Value=" + e.Current);
26                         total += (int) e.Current;
27                 }
28
29                 if (total != 491)
30                         return 1;
31                 return 0;
32         }
33 }