using System;
class Program
{
private static void Main(string[] args)
{
int[] pn = { 9, 8, 7, 6, 5, 4 };
foreach (var item in pn)
{
if (item == 6)
{
break;
}
Console.WriteLine(item);
}
Console.ReadKey();
}
}
|
Class Program
Private Shared Sub Main(args As String())
Dim pn As Integer() = { 9, 8, 7, 6, 5, 4 }
For Each item As var In pn
If item = 6 Then
Exit For
End If
Console.WriteLine(item)
Next
Console.ReadKey()
End Sub
End Class
|