Yes, you can loop inside a loop.
The inner loop would run through completely, each time that the outer loop does one pass.
Suppose you believed that one memory address leaked into another memory address. You were certain that these two addresses were not next to each other.
So the outer loop would scan through all of the memory addresses in question. The inner loop would check the current outer loop address with each of the addresses that you were testing. So that inner look would run the whole range of addresses as the outer loop advanced to the next.
This would be a very extensive program that could take a very long time to run. Especially if you were testing a 1GB memory stick.
In the early 1980s, I did suspect this sort of problem in a memory system. The old slow computer ran this test over about 12 hours. The memory system was only 1000 bytes. The fault was found and the memory chip was replaced.
2006-09-09 16:50:44
·
answer #1
·
answered by Anonymous
·
0⤊
0⤋
Yes. Example for Visual Basic:
1. Create a Form
2. Create a Command Button
3. Double click on the Command Button and type the below code:
Private Sub Command1_Click()
Dim OuterLoop, InnerLoop as integer
for OuterLoop = 1 to 3
print "Outer Pass: " & OuterLoop
for InnerLoop = 1 to 5
print " Inner Counter: " & InnerLoop
next
next
The result should look like:
Outer Pass: 1
Inner Counter: 1
Inner Counter: 2
Inner Counter: 3
Inner Counter: 4
Inner Counter: 5
Outer Pass: 2
Inner Counter: 1
Inner Counter: 2
Inner Counter: 3
Inner Counter: 4
Inner Counter: 5
Outer Pass: 3
Inner Counter: 1
Inner Counter: 2
Inner Counter: 3
Inner Counter: 4
Inner Counter: 5
Good luck!
2006-09-09 17:06:38
·
answer #2
·
answered by papadaddy 3
·
0⤊
0⤋
Yes. you can nest loops. They will both get executed as long as the logic is correct.
2006-09-09 16:44:16
·
answer #3
·
answered by msaathof 3
·
0⤊
0⤋
A fruit loop field is stable, in spite of the incontrovertible fact that it would be even greater suitable if it had a blanket on it, and replaced into on a pile of newspapers that replaced into on a chair. however a cat can discover this is roofed in some thing and on suitable of a few thing this is on suitable of or interior some thing else is the terrific place for a sleep. thank you for the hyperlink. What a alluring kin you have!
2016-12-15 05:26:56
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋
yes u can and it is pretty simple. u can nest as many loops u wish and the innermost loop executes firstly and when it exits next outer loop..............
2006-09-09 17:52:43
·
answer #5
·
answered by Amila 1
·
0⤊
0⤋
Yes it is possible.
Do While condition
statements
Do While condition
statements
Loop
statements
Loop
Sorry, I couldn't get the tabs to work but you get the points
Have fun, be prosperous, and be safe!
2006-09-09 16:46:10
·
answer #6
·
answered by Anonymous
·
0⤊
0⤋
you can connect nest looping but u have to have a way to exit-they wont get executed -its simple procedure-relax ok
2006-09-12 21:55:23
·
answer #7
·
answered by ? 5
·
0⤊
0⤋
only if the second loop has a way to exit
2006-09-09 16:43:22
·
answer #8
·
answered by Anonymous
·
0⤊
0⤋
int i = 0;
int j = 0;
while (i<3)
{
while (j<3)
{
cout<<"i is "<
j++;
}
cout<
i++;
}
the output will be
i is 0 j is 0
i is 0 j is 1
i is 0 j is 2
i is 1 j is 0
i is 1 j is 1
i is 1 j is 2
i is 2 j is 0
i is 2 j is 1
i is 2 j is 2
2006-09-09 16:45:16
·
answer #9
·
answered by kurt_ram 2
·
0⤊
0⤋
Oh sure, that is simple nesting.
2006-09-09 16:44:19
·
answer #10
·
answered by Andy T 7
·
0⤊
0⤋