
-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 7:20 pm

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 
[code]for counter1:1..5 
     put num," "..
end for[/code]
The other one is like this..
[code]for counter:1..12
     put " ":12,counter
end for[/code]
how can I make the first loop repeat by using the second loop format..
Thanks

-----------------------------------
Tony
Tue Mar 03, 2009 7:27 pm

RE:How to make a for loop inside a for loop?
-----------------------------------
do you know how a for-loop works? Describe it in words.

-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 7:36 pm

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...

-----------------------------------
Tony
Tue Mar 03, 2009 7:40 pm

RE:How to make a for loop inside a for loop?
-----------------------------------
read the documentation -- statementsAndDeclarations

-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 7:52 pm

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?

-----------------------------------
Tony
Tue Mar 03, 2009 7:58 pm

RE:How to make a for loop inside a for loop?
-----------------------------------
yes. Now, what kind of statements can you put in it's place?

-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 8:15 pm

RE:How to make a for loop inside a for loop?
-----------------------------------
I think you can put anything...

-----------------------------------
Tony
Tue Mar 03, 2009 8:19 pm

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)

-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 8:30 pm

Re: How to make a for loop inside a for loop?
-----------------------------------
uh.huh..i get that part..but if I do it like this
[code]for counter:1..12
    for counter1:1..5 
        put num," "..
    end for
end for[/code]

it doesnt work

-----------------------------------
Tony
Tue Mar 03, 2009 8:32 pm

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?

-----------------------------------
BigBear
Tue Mar 03, 2009 8:32 pm

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.

-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 8:41 pm

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..

-----------------------------------
Tony
Tue Mar 03, 2009 8:43 pm

RE:How to make a for loop inside a for loop?
-----------------------------------
what does .. do in
[code]
put "text"..
[/code]

-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 8:45 pm

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

-----------------------------------
Tony
Tue Mar 03, 2009 8:56 pm

RE:How to make a for loop inside a for loop?
-----------------------------------
does this solve your problem?

-----------------------------------
enchanted_bloom
Tue Mar 03, 2009 9:00 pm

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..
