有没有办法像其他语言一样在 OpenOffice Basic 中继续循环?
For i = 0 To 10
If i = 5 Then
Continue For # Not working
End If
Next i
我知道语法Exit For可以打破循环,但我必须跳过一些迭代......提前谢谢你!
有没有办法像其他语言一样在 OpenOffice Basic 中继续循环?
For i = 0 To 10
If i = 5 Then
Continue For # Not working
End If
Next i
我知道语法Exit For可以打破循环,但我必须跳过一些迭代......提前谢谢你!
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
提议的条款似乎处理异常,而不是正常情况。
有同样的问题,通过将迭代器等同于自身来解决,即 i = i。
For i = 0 To 10
If i = 5 Then
GoTo Continue
End If
Continue:
Next i