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

ASP
ASP XML操作类代码
asp读取xml实例代码
ASP读取XML实例 优酷专辑采集程序 雷锋版
asp自带的内存缓存 application
Cookies 欺骗漏洞的防范方法(vbs+js 实现)
asp清理缓存的代码
asp Driver和Provider两种连接字符串连接Access时的区别
asp 性能测试报告 学习asp朋友需要了解的东西
ASP实例代码:asp操作Excel类
ASP 高亮显示不区分大小写的关键字
ASP XMLDom在服务器端操作XML文件的主要方法和实现
IE8内部对渲染模型的判断流程
web开发人员必须知道的Unicode与字符集相关知识

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


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