using System;
using System.Collections.Generic;
using System.Text;
namespace ProgrammerDictionaryTutorialCode
{
class ListAndForLoopUsage
{
//Program entry point
public static void Main()
{
//Initialize the list for integers
List<int> list = new List<int>();
//manually adding items to the list one at a time
list.Add(0);
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
list.Add(5);
list.Add(6);
list.Add(7);
// for loop. the integer i is set at 0, if 0 is less than the max number in the list
for (int i = 0; i < list.Count;)
{
//Console writes the integer i as a number until it is equal to 7 before it exits the loop
Console.WriteLine(i++);
}
//once again... So the program will not exit before we can read it
Console.Read();
}
}
}
using System.Collections.Generic;
using System.Text;
namespace ProgrammerDictionaryTutorialCode
{
class ListAndForLoopUsage
{
//Program entry point
public static void Main()
{
//Initialize the list for integers
List<int> list = new List<int>();
//manually adding items to the list one at a time
list.Add(0);
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
list.Add(5);
list.Add(6);
list.Add(7);
// for loop. the integer i is set at 0, if 0 is less than the max number in the list
for (int i = 0; i < list.Count;)
{
//Console writes the integer i as a number until it is equal to 7 before it exits the loop
Console.WriteLine(i++);
}
//once again... So the program will not exit before we can read it
Console.Read();
}
}
}