how to exit?

  • Thread starter Thread starter sloan
  • Start date Start date
strSQL = Server.MapPath("remessa\\") + "CSG" +
(DateTime.Now.Year.ToString().Substring(DateTime.Now.Year.ToString().Length
- 1) + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00"));

for (int i = 1; i < 1000; i++)
{
if (!File.Exists(strSQL + i.ToString("000") + ".rem"))
{
sNomeFile = strSQL + i.ToString("000") + ".rem";
return for / exit for; //??????????????????????????????
}
}

Hi,

How to 'exit for' when such condition above?

VS 2005 asp.net C# 2.0

Thanks a lot
 
if (!File.Exists(strSQL + i.ToString("000") + ".rem"))
{
sNomeFile = strSQL + i.ToString("000") + ".rem";
break;
}
 
or or those structured code followers that do not allow use of a break
or a return:


for ( int i=0;
i < 1000 && File.Exists(strSQL + i.ToString("000") + ".rem");
++i
)
{
// do something
}

-- bruce (sqlwork.com)
 
Back
Top