Exiting a nested loop

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi all,

It may be that I am getting this wrong or doing it the wrong way but
this has been stuck.

I have a loop inside a loop, based on a certain condition i want to
cause the primary loop "to loop". If that makes sense! see the pseudo
code below:


For Each MyFile in Files

For Each FileExtension In ArrayList
If Path.GetExtension(FileExtension)="doc" Then
Exit This For Eacg
Move To Next MyFile
Next

Next


So, basically, if the file extension is equal to one of the values in my
list then I just want to ignore and grab the next file to process.
 
For Each MyFile As String In MyFiles

' If the extension is in the list, then we found one...

If ExtensionList.Contains ( Path.GetExtension ( MyFile ) ) Then

' Exit For?

End If

' Not in the list, so continue.....

Next
 
Robin said:
For Each MyFile As String In MyFiles

' If the extension is in the list, then we found one...

If ExtensionList.Contains ( Path.GetExtension ( MyFile ) ) Then

' Exit For?

End If

' Not in the list, so continue.....

Next

Works perfect, thanks.
 
Back
Top