hxb
asked on
For .. Next
VB6,
How to goto the next loop in
"For.. Next" and skip the other
code?
For example:
For i=1 to 100
j=6
k=10
if blnYes=true then
'Here how to skip the code
' of k=k+j ... and let it
' execute Next i?
endif
k=k+j
next i
How to goto the next loop in
"For.. Next" and skip the other
code?
For example:
For i=1 to 100
j=6
k=10
if blnYes=true then
'Here how to skip the code
' of k=k+j ... and let it
' execute Next i?
endif
k=k+j
next i
ASKER
Same question about
Do while true
Loop
I know I can use "If Then" and "GOTO"
But is there any other simple Code
such as "Loop" or Other Code I
can Use?
Do while true
Loop
I know I can use "If Then" and "GOTO"
But is there any other simple Code
such as "Loop" or Other Code I
can Use?
Same applies to both do while and to For.
For i = 0 to 10
if i = 3 then
exit for
end if
next
i = 0
do while i < 10
i = i + 1
if i =5 then
exit do
end if
loop
For i = 0 to 10
if i = 3 then
exit for
end if
next
i = 0
do while i < 10
i = i + 1
if i =5 then
exit do
end if
loop
HXB
I am not so sure about your qn but your syntax is slightly wrong. it should be
For i =1 to 100
..
..
..
..
next
There should not be a next i
Hope this helps
Ivanc
I am not so sure about your qn but your syntax is slightly wrong. it should be
For i =1 to 100
..
..
..
..
next
There should not be a next i
Hope this helps
Ivanc
actually you can take that step out but there is nothing wrong
next i
just tells to pcocess next element.
next i
just tells to pcocess next element.
marine
Tks for pointing it out to me
Ivanc
Tks for pointing it out to me
Ivanc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
pjknibbs,
Your answner is OK.
Your answner is OK.
or
If blnYes = True Then
'do some code
Else
k=k+j
End If
or use a 'goto'