I though that the exit statement could be used
to exit from within a loop. Even the docs say so. However given the following code:
x=1
while x<10
response.write x
if x=5 then
exit do
end if
x=x+1
wend
I'm getting:
Microsoft VBScript compilation error '800a040f'
Invalid 'exit' statement
/itron/specials.asp, line 204
Exit Do
-----^
Any ideas?
Thanks,
Jorge
Your best bet may be to just not "fight-the-problem" and rewrite the loop as
a do-loop.
x=1
Do le x<10
response.write x
if x=5 then
exit do
end if
x=x+1
Loop
cheers, jw
"Jorge Santos" <san...@traxxinc.net> wrote in message
news:cae54c12.02041...@posting.google.com...
> Do WHILE x<10
time get off here, and goto lunch, jw
"jim_w" <jwarrington*noSteekin*@*Spam*worldnet.att.net> wrote in message
news:u7qSPkk4BHA.1864@tkmsftngp04...
You could use a do while loop with your code as follows:
x=1
Do while x < 10
response.write x
If x = 5 then
exit do
end if
x = x + 1
Loop
"Jorge Santos" <san...@traxxinc.net> wrote in message
news:cae54c12.02041...@posting.google.com...
x=1
while x<10
response.write x
if x=5 then
x=10
else
x=x+1
end if
wend
"Joseph Acosta" <jac...@san.rr.com> wrote in message
news:eF90fok4BHA.1288@tkmsftngp07...
I was aware of the Do While .. Loop and Do .. Loop Until but wan't aware
that Exit Do is only for Do loops (never get the obvious...).
Thanks again.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!