To quote Dan:
Write a program that counts to infinity. Twice.
Well, here you go!
public class Counter
{
public static void Main(string[] Args)
{
UInt16 numCounts = 2;
for (UInt16 i = 0; i < numCounts; i++)
{
UInt64 value = UInt64.MinValue;
for (; value < UInt64.MaxValue; value++)
{
Console.WriteLine(value.ToString());
}
Console.WriteLine(value.ToString());
}
Console.ReadLine();
}
}
As far as the CLR is concerned, that is pretty much what you are doing right there (Integer wise).
Edit: And here is real, compilable C# to count twice to infinity!
public class Counter
{
public static void Main(string[] Args)
{
UInt16 numCounts = 2;
for (UInt16 i = 0; i < numCounts; i++)
{
Double value = Double.NegativeInfinity;
for (; value < Double.PositiveInfinity; value++)
{
Console.WriteLine(value.ToString());
}
Console.WriteLine(value.ToString());
}
Console.ReadLine();
}
}
Yes! The above code compiles! (C#)