Solved

for loop and inner loop

Posted on 2012-04-13
1
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Part One of the two-part Q&A series with MalwareTech.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.

617 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