当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP如何跳出本次进入下一次循环

ASP
Asp Object 之:End
Asp Object 之:ServerVariables
Asp Object 之:Expires
Asp Object 之:ExpiresAbsolute
Asp Object 之:Flush
Asp Object 之:Form
Asp Object 之:IsClientConnected
Asp Object 之:PICS
Asp Object 之:QueryString
Asp Object 之:Redirect
Asp Object 之:Request.Cookies
Asp Object 之:Request
Asp Object 之:Response.Cookies
Asp Object 之:Response
Asp Object 之:Status
Asp Object 之:TotalBytes
Asp Object 之:Write
用ASP.Net编写留言本
如何把ASP编写成DLL(1)
如何把ASP编写成DLL(2)

ASP如何跳出本次进入下一次循环


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 198 ::
收藏到网摘: n/a

 看下面的Java代码,目的是为了当i是3的时候,就不做输出,直接跳到下一个循环。

        int i = 0;
        while (i < 5) ...{
            i++;
            if (i == 3) ...{
                continue;
            }
            System.out.println("I'm not 3, I'm " + i);
            // Do something else...
        }
 然而在ASP (VB) 应该怎么写呢?不少人就犯难了。在此,我给出些答案供参考,还往多多指教!

    i = 0
    Do While (i < 5)
        If (i <> 3) Then
            'MsgBox "I'm not 3, I'm " & i
            'Do something else...

        End If
        i = i + 1
    Loop
 显然,上面的例子会贻笑大方。

    i = 0
    Do While (i < 5)
        For j = 1 To 1
            If (i = 3) Then
                Exit For
            End If
            'MsgBox "I'm not 3, I'm " & i
            'Do something else...
           
        Next j
        i = i + 1
    Loop