Use a foreach loop through an int array
class MainClass
{
public static void Main()
{
int [] myValues = {2, 4, 3, 5, 1};
foreach (int counter in myValues)
{
System.Console.WriteLine("counter = " + counter);
}
}
}
Output counter = 2
counter = 4
counter = 3
counter = 5
counter = 1
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
|