openoffice.orgopenoffice-basic

Continue For Loop in OpenOffice Basic


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!


Solution

  • 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.