array<int> ^ints = gcnew array<int>{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for each(int i in ints)
if(i % 2 == 0)
Debug::WriteLine("Even\n");
else
Debug::WriteLine("Odd\n");
Why does the above fail to compile? It works fine if I use a for(int i; ...)
or if I enclose the if-else
within braces. I know that the manual clearly indicates that braces are required, but I want to know why this departure from expected behaviour?