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

ASP
ASP编程中15个非常有用的例子 (二)
ASP与JSP的比较(一)
ASP与JSP的比较(二)
ASP中五种连接数据库的方法
从ASP调用SQL中的图像
用排序串字段实现树状结构(例程:连接字串)
用排序串字段实现树状结构(例程:删除贴子)
用排序串字段实现树状结构(例程:回复表单)
用排序串字段实现树状结构(例程:显示贴子内容)
用排序串字段实现树状结构(例程:显示树)
用排序串字段实现树状结构(存储过程)
用排序串字段实现树状结构(库结构)
用排序串字段实现树状结构(原理)
remote script文档(转载自微软)(一)
remote script文档(转载自微软)(二)
remote script文档(转载自微软)(三)
remote script文档(转载自微软)(四)
remote script文档(转载自微软)(五)
remote script文档(转载自微软)(六)
remote script文档(转载自微软)(七)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 112 ::
收藏到网摘: 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