how to exit?

P

Paulo

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
 
M

Mark Rae [MVP]

if (!File.Exists(strSQL + i.ToString("000") + ".rem"))
{
sNomeFile = strSQL + i.ToString("000") + ".rem";
break;
}
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top