Home All Groups Group Topic Archive Search About
Author
11 Mar 2006 1:31 AM
Anibal David Acosta F.
do you know how can I do something like this..

CurValue = 20; //or other value

for (int i=CurValue; i >=0; i--)
{
    //do something here
}

when I compile an error occur and the "underline error mark" is below the
"i--"
the error is: "Unrecheable code detected (CS0162)"

Is possible to do a decreasing for in C# ?

Author
11 Mar 2006 2:20 AM
Tom Porterfield
Anibal David Acosta F. wrote:
Show quoteHide quote
> do you know how can I do something like this..
>
> CurValue = 20; //or other value
>
> for (int i=CurValue; i >=0; i--)
> {
>    //do something here
> }
>
> when I compile an error occur and the "underline error mark" is below the
> "i--"
> the error is: "Unrecheable code detected (CS0162)"
>
> Is possible to do a decreasing for in C# ?

That code (with an int before the declaration of CurValue) compiles fine for
me with no errors or warnings in both VS.NET 2003 and 2005.
--
Tom Porterfield

Bookmark and Share