S
sillyhat
a bit off topic, but...
If I wanted to iterate through 0 to 255 using a byte variable,
then this first attempt would not work, as it gives an infinite loop.
for(byte i=0;i<=255;i++)
Console.Write(i + " ");
This next attempt does work but its would be nicer to have the exit
condition test within the for statement:
for(byte i=0;;i++)
{
Console.Write(i + " ");
if(i==255)break;
}
Is it possible to make the first loop work by tweaking the parameters
a little?
Ignore the fact that this might be an ideal candidate for a cast!
Hal
If I wanted to iterate through 0 to 255 using a byte variable,
then this first attempt would not work, as it gives an infinite loop.
for(byte i=0;i<=255;i++)
Console.Write(i + " ");
This next attempt does work but its would be nicer to have the exit
condition test within the for statement:
for(byte i=0;;i++)
{
Console.Write(i + " ");
if(i==255)break;
}
Is it possible to make the first loop work by tweaking the parameters
a little?
Ignore the fact that this might be an ideal candidate for a cast!
Hal