for i = 1 to 10
    if i = 5 then
        '这里要跳到下一个i
    else
        debug.print i
    end if
next输出应该是1 2 3 4 6 7 8 9 10的数列
不要用goto

解决方案 »

  1.   

    for i = 1 to 10
        if i <>5 then
            debug.print i
        end if
    next
      

  2.   

    for i=1 to 10
    if i<>5 then 
       debug.print i
    end if
      

  3.   

    好像除了GOTO还没相出来别的办法。
      

  4.   

    for i = 1 to 10
        if i = 5 then
            '这里什么都不写
        else
            debug.print i
        end if
    next
      

  5.   

    用判断语句啊。
    for i = 1 to 10
        if i = 5 then
            '这里要跳到下一个i
        else
            debug.print i
        end if
    next
    可以改成:
    for i = 1 to 10
        if i <> 5 then  debug.print i
    next
    这不就结了吗?
    结构化的程序是根本不需要GOTO这个东西的,只要有分支,循环,判断这三种方法就可以得到任意的逻辑结构。
      

  6.   

    请问楼上的,为什么java里面有continue这种功能?
    我的问题是vb里有没有这种功能,上面只是个最简单的例子,你这种写法我当然知道,可是和我的需求根本是两码事