Computer Science Canada How to make a for loop inside a for loop? |
Author: | enchanted_bloom [ Tue Mar 03, 2009 7:20 pm ] | ||||
Post subject: | How to make a for loop inside a for loop? | ||||
As I said, a line is already a for loop,how can I put this loop inside a for loop...I've seperated the two loops,but I don't get how I can put one inside of the other one. One of the loop is like this
The other one is like this..
how can I make the first loop repeat by using the second loop format.. Thanks |
Author: | Tony [ Tue Mar 03, 2009 7:27 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
do you know how a for-loop works? Describe it in words. |
Author: | enchanted_bloom [ Tue Mar 03, 2009 7:36 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
The loop will countinue each time adding up the numbers until the number previously declared.. I think..i'm not sure... |
Author: | Tony [ Tue Mar 03, 2009 7:40 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
read the documentation -- http://compsci.ca/holtsoft/doc/for.html then tell me what is meant by statementsAndDeclarations |
Author: | enchanted_bloom [ Tue Mar 03, 2009 7:52 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
It basically is a execution that keeps on repeating according to the number of times it was declared,each time adding one to the time repeated.It will stop until it has reached the last value declared. IS it? |
Author: | Tony [ Tue Mar 03, 2009 7:58 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
yes. Now, what kind of statements can you put in it's place? |
Author: | enchanted_bloom [ Tue Mar 03, 2009 8:15 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
I think you can put anything... |
Author: | Tony [ Tue Mar 03, 2009 8:19 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
well... as the name implies: statements And Declarations. another for-loop happens to be a statement (as is said in top-right corner of the documentation page) |
Author: | enchanted_bloom [ Tue Mar 03, 2009 8:30 pm ] | ||
Post subject: | Re: How to make a for loop inside a for loop? | ||
uh.huh..i get that part..but if I do it like this
it doesnt work |
Author: | Tony [ Tue Mar 03, 2009 8:32 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
why not? I get a compile error for that piece of code; what does it say? |
Author: | BigBear [ Tue Mar 03, 2009 8:32 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
That will start the first for loop then enter the second and stay in the second untill it is done then restart the first one which will go into the second etc. |
Author: | enchanted_bloom [ Tue Mar 03, 2009 8:41 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
when it comes out it's a bunch of letters crampled together when i wanted them to be in seperate lines.. |
Author: | Tony [ Tue Mar 03, 2009 8:43 pm ] | ||
Post subject: | RE:How to make a for loop inside a for loop? | ||
what does .. do in
|
Author: | enchanted_bloom [ Tue Mar 03, 2009 8:45 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
oh..it makes the second loop continue on the same line making it look like this X X X X X if i didn't do that it will look like this X X X X X |
Author: | Tony [ Tue Mar 03, 2009 8:56 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
does this solve your problem? |
Author: | enchanted_bloom [ Tue Mar 03, 2009 9:00 pm ] |
Post subject: | RE:How to make a for loop inside a for loop? |
eh...I still don't get how to make it to the way i wanted it to look..but i'll try some more.. |