473,383 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Exiting a nested loop

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.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #1
3 1102


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

"Daniel" <da****@madridmadridsoleado.com> wrote in message
news:u3*************@TK2MSFTNGP10.phx.gbl...
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.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Nov 21 '05 #2
Daniel,

Exit For

Kerry Moorman
"Daniel" wrote:
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.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Nov 21 '05 #3
Robin Tucker wrote:
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

"Daniel" <da****@madridmadridsoleado.com> wrote in message
news:u3*************@TK2MSFTNGP10.phx.gbl...
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.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.



Works perfect, thanks.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
by: vineoff | last post by:
If I'm having nested loops like: for (...) for (..) for (...) { /* exit here */ } and I need to exit from there ^ . Is it better to use exceptions or goto or some other method?
5
by: Martin Schou | last post by:
Please ignore the extreme simplicity of the task :-) I'm new to C, which explains why I'm doing an exercise like this. In the following tripple nested loop: int digit1 = 1; int digit2 = 0;...
46
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are...
22
by: L. Westmeier | last post by:
Is there a way to have to exiting point in a void function? I don't want to exit the program but just this function. Any answers appreciated. L. Westmeier
17
by: Peter Olcott | last post by:
http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html Why is C# 500% slower than C++ on Nested Loops ??? Will this problem be solved in...
1
by: Karl O. Pinc | last post by:
FYI, mostly. But I do have questions as to how to write code that will continue to work in subsequent postgresql versions. See code below. begintest() uses EXIT to exit a BEGIN block from...
77
by: Peter Olcott | last post by:
http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html The above link shows that C# is 450% slower on something as simple as a nested loop....
8
by: Nathan Sokalski | last post by:
I have several nested For loops, as follows: For a As Integer = 0 To 255 For b As Integer = 0 To 255 For c As Integer = 0 To 255 If <Boolean ExpressionThen <My CodeElse Exit For Next If Not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.