3

有没有办法像其他语言一样在 OpenOffice Basic 中继续循环?

For i = 0 To 10

  If i = 5 Then
     Continue For # Not working
  End If  

Next i

我知道语法Exit For可以打破循环,但我必须跳过一些迭代......提前谢谢你!

4

3 回答 3

2

AFAIK 没有,但您也可以使用该If子句跳过某些迭代:

For i = 0 To 10

  If i <> 5 Then
     # Execute some commands except in the fifth iteration
  End If  

Next i

当然,使用类似的东西Continue会更好,因为If提议的条款似乎处理异常,而不是正常情况。

于 2015-12-22T10:59:37.250 回答
0

有同样的问题,通过将迭代器等同于自身来解决,即 i = i。

于 2016-08-24T00:44:55.563 回答
0
For i = 0 To 10

  If i = 5 Then
     GoTo Continue 
  End If  


Continue:
Next i
于 2020-03-10T00:36:57.747 回答