Solved

for loop and inner loop

Posted on 2012-04-13
1
220 Views
Last Modified: 2012-08-14
For i As Integer = 0 To 10 - 1

            Console.WriteLine("i : " & i)

            For j As Integer = 3 To 10

                Console.WriteLine("j : " & j)
                Exit For

            Next

        Next

the following produce

i : 0
j : 3
i : 1
j : 3
i : 2
j : 3
i : 3
j : 3
i : 4
j : 3
i : 5
j : 3
i : 6
j : 3
i : 7
j : 3
i : 8
j : 3
i : 9
j : 3

how to produce

i : 0
j : 3
i : 1
j : 4
i : 2
j : 5
i : 3
j : 6
i : 4
j : 7
i : 5
j : 8
i : 6
j : 9
i : 7
j : 10
i : 8
j : 3
i : 9
j : 4
i : 10
j : 5
i : 11
j : 6
i : 12
j : 7
i : 13
j : 8
i : 14
j : 9
i : 15
j : 10
i : 16
j : 3
i : 17
j : 4
...etc
0
Comment
Question by:doramail05
1 Comment
 
LVL 8

Accepted Solution

by:
X-treem earned 500 total points
ID: 37841752
don't use a for loop for J but do a caculation
j=(i mod 8)+3
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now