Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

for loop and inner loop

Posted on 2012-04-13
1
Medium Priority
?
268 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 2000 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 Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

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…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

705 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