Search code examples
loopsvbscriptasp-classic

Classic ASP do while, move to next loop in advance


I was wondering if there is any way you can start over in a do until-loop earlier than its ordinary loop end point.

Non-working example to try and explain what I want:

do until RS.eof
  ...
amount = RS("product_amount")
response.write(amount)
if amount > 5 then
    rs.movenext
    loop
end if
  ...
rs.movenext
loop

The ...'s symbolizes more code.

And yes, I understand I can just put an if-tag around the bottom code to skip to the end loop, but I want to try and keep it as clean as possible without a lot of nested if-statements.


Solution

  • No. The only thing you can use is Exit Do which will exit the do entirely. You will have to rely on if...thens to keep things separated like you are currently doing.