Solved

for loop and inner loop

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

752 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