Question question on loops

andrews

Well-known member
Joined
Nov 22, 2011
Messages
167
Programming Experience
5-10
I do not know how I had to solve this :

do while condition
' do something
loop

this is the normal method

but what I want

if condition2 then
do while condition1
' do something
else
do while condtion2
' do something else
end if
loop

Is this possible?
Thanks for any resonse
 
The code you posted isn't legal and, while it hints at what you want, posting code that doesn't work and then expecting people to make it work without explaining what it is supposed to actually do is expecting magic or luck. Please provide a FULL and CLEAR explanation of what you're actually trying to achieve. When we know what the code is supposed to do, then we can make the code do it.
 
Sorry, I make a mistake , it had to be

I do not know how I had to solve this :

do while condition
' do something
loop

this is the normal method

but what I want

if condition3 then
do while condition1
' do something
else
do while condtion2
' do something else
end if
loop

Is this possible?
I want to make two kinds of a loop depending of a condition like f.e the value of a variable
I hope it is clear now.

Thanks for any resonse


 
Yes what you want to do is possible.

Have you tried writing the code line by line and seeing what happens? You will find the auto-complete structure differs from your example and the solution presents itself.
 
I received a error.
I think it is possible but the code must be different than what I wrote.
Someone who knows?
 
Sorry, but I think that you can not answer the question.
I can give you a simple example but you can do this too.
If not I will do that.
 
andrews you are wasting time.. It seems that you are not even trying to learn.. The only piece of code you provided was structured incorrectly. I typed this code into vb editor and the auto-complete feature built into visual studio created the correct structure and achieved what it is you are looking to do.

If you typed in this code yourself, you would see what I mean. Why you are having trouble with this is a mystery.
 
I know that the code is not correct, that is the reason I asked for help.
But I found now a solution.
Thanks anyway for the help.
 
Back
Top