Continue [label]

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Continue [label]

Post by Psychophanta »

What i mean:

Code: Select all

  ForEach f1()
    ForEach f2()
    
      ;code in which i need data from this f2() element to decide whether open f1() or not...

      If open=0  ;if it wasn't previously open then open it:
        While ReadFile(0,f1()\path$+f1()\nombre$)=0
          Select MessageBox_(hWnd,"Can't open file"+Chr(10)+f1()\path$+f1()\nombre$,"HOP!",#MB_ABORTRETRYIGNORE|#MB_ICONEXCLAMATION)
          Case #IDABORT
            Break 3;finish all
          Case #IDIGNORE
            Break 2;continue with next f1()
          EndSelect;if #IDRETRY then try again
        Wend
        open=1
      EndIf
      ;file #0 open, so then try to open the second:
      While ReadFile(1,f2()\path$+f2()\nombre$)=0
        MSB.l=MessageBox_(hWnd,"Can't open file"+Chr(10)+f2()\path$+f2()\nombre$,"HOP!",#MB_ABORTRETRYIGNORE|#MB_ICONEXCLAMATION)
        If MSB=#IDABORT
          Closefile(0)
          Break 3;finish all
        ElseIf MSB=#IDIGNORE;Ignore, so continue with next f2():
          ;Continue 2 ;<--- this doesn't work, so i must perform a GOTO  8O 
          Goto Continue2
        EndIf;If #IDRETRY then try again
      Wend
      ;Now both files #0 and #1 are open:
      
      ;code...

      CloseFile(1)
Continue2:
    Next
    If open:CloseFile(0):open=0:EndIf
  Next