Solved

for loop and inner loop

Posted on 2012-04-13
1
249 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
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.

828 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