3

Is there a way to continue a loop in OpenOffice Basic like in other language?

For i = 0 To 10

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

Next i

I know the Syntax Exit For to break a loop but I have to skip some iterations... Thank you in advance!

tohuwawohu
  • 13,268
  • 4
  • 42
  • 61
Viatorus
  • 1,804
  • 1
  • 18
  • 41
  • 1
    As @tohuwawohu said, there does not seem to be any such syntax. See https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Loops. However with OpenOffice you can use other languages that do have this, such as Java or Python. – Jim K Dec 22 '15 at 23:40
  • @JimK: Good point! Didn't think of other, feature-rich languages myself - would be worth an answer... – tohuwawohu Dec 23 '15 at 10:28

3 Answers3

3

AFAIK there isn't, but you also can use the If clause to skip certain iterations:

For i = 0 To 10

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

Next i

Of course, using something like Continue would be better style, since the If clause as proposed seems to handle an exception, not the normal case.

tohuwawohu
  • 13,268
  • 4
  • 42
  • 61
0

Had the same problem, got around did by equating the iterator to itself, i.e. i = i.

0
For i = 0 To 10

  If i = 5 Then
     GoTo Continue 
  End If  


Continue:
Next i
Kai
  • 1