473,379 Members | 1,201 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,379 software developers and data experts.

force next iteration in for...next

Is there any way in VB to force the next iteration in a For ... next loop
other than
using a GoTo?

I notice that in C++ you can use 'continue' and in other languages there are
syntax for this. Am I missing something?

For an example, if a = false I don't want the if b = true to execute.

for i = 1 to 10

if a = true
do stuff
else
'go to next iteration
end if

if b = true
do some more stuff
end if
next i

TIA,
Marc Miller

May 15 '06 #1
2 3535
"Marc Miller" <mm****@hotmail.com> schrieb:
Is there any way in VB to force the next iteration in a For ... next loop
other than
using a GoTo?


In VB.NET 2002/2003 you may want to use 'GoTo' together with a named label.
In VB.NET you can simply use 'Continue' or 'Continue For', depending on the
situation.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 15 '06 #2
> Is there any way in VB to force the next iteration in a For ... next
loop
other than
using a GoTo?
I notice that in C++ you can use 'continue' and in other languages
there are syntax for this. Am I missing something?

For an example, if a = false I don't want the if b = true to execute.

for i = 1 to 10

if a = true
do stuff
else
'go to next iteration
end if
if b = true
do some more stuff
end if
next i
TIA,
Marc Miller


VB 2005 introduced the Continue statement in VB. See http://msdn2.microsoft.com/en-us/library/801hyx6f.aspx.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
May 15 '06 #3

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

Similar topics

35
by: Raymond Hettinger | last post by:
Here is a discussion draft of a potential PEP. The ideas grew out of the discussion on pep-284. Comments are invited. Dart throwing is optional. Raymond Hettinger ...
2
by: Abdullah Khaidar | last post by:
Is there any iteration style we must use to get faster processing time? I've tried with some style to concat number in list. But I still don't know which one is the recommended style. >>> def...
10
by: Brian Burgess | last post by:
Hi all, Is there any 'trick' anyone knows to control a For Next to pass to the next iteration in ASP VBScript? ..Similar to the 'continue' keyword of C and C++? Thanks in advance.. -BB
1
by: DottingTheNet | last post by:
Hi ppl!! just a newbie ques is there something in PL/SQL that skips to the next iteration in the for loop like a next, etc.???? Thnx!!
1
by: aj | last post by:
DB2 v8 FP5 Red Hat AS/EL 2.1 For disaster recovery purposes (I'm in FL), I am utilizing a custom DB2 userexit to FTP logical logs to an alternate site in prep for a potential restore and roll...
23
by: Mitchell Vincent | last post by:
Is there any way to "skip" iterations in a for loop? Example : for x = 1 to 10 if something = 1 next endif
9
by: paul c | last post by:
Apologies if I'm sending this to the wrong group. If so I'd be grateful if somebody could point me to the right one. I'm using microsoft visual c++ 6.0 compiler. My code is C, I just use the...
4
by: Steve | last post by:
C# I am iterating through a collection of rows thus: foreach(DataRow myRow in dsTable.Table.Rows) { ........... } in this loop I have some conditions and when one is met I dont want it to
11
by: estantep | last post by:
Hello, I am trying to find out an alternate way to brute-force a variable length vector with different variable length contents. int chromossome int max_value_for_each_chromossome
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.