# Loop actions inside a loop

Status
Not open for further replies.

#### ultimate11

Level 5
For exe: It doesnt work good.It is wrong to use loop B inside loop B ?

• Untitled Trigger 001
• Events
• Conditions
• Actions
• For each (Integer A) from 1 to 10, do (Actions)
• Loop - Actions
• For each (Integer B) from 1 to 8, do (Actions)
• Loop - Actions
• Set Integer[1] = (Integer B)
• For each (Integer B) from 1 to 4, do (Actions)
• Loop - Actions
• Multiboard - Set the text for (Last created multiboard) item in column Integer[1], row 1 to String[(Integer B)]
• -------- Other types of actions --------

#### claptomanic

Level 9
afaik you cant loop through integer B inside a integer B loop Oo

i would recommend to use 'for each Integer Variable' loops instead of integer A & B....read somewhere that its better to use it instead of A & B...but i dont remember why.

#### ap0calypse

Level 28
I also recommend you do not use arrays for stuff like "Set Integer[1] = Integer B", use a non-arrayed variable for that. Also do not use arrays for the loop integers.

• For each (Integer loopInt1) from 1 to 10, do (Actions)
• Loop - Actions
• For each (Integer loopInt2) from 1 to 8, do (Actions)
• Loop - Actions
• For each (Integer loopInt3) from 1 to 4, do (Actions)
• Loop - Actions
• Multiboard - Set the text for (Last created multiboard) item in column loopInt2, row 1 to String[loopInt3]
I don't really see why you need 3 loops for that though.
You basically do the same thing 10 times over, which is a huge waste.
It is possible to remove the first loop and it will work just fine.

claptomanic said:
would recommend to use 'for each Integer Variable' loops instead of integer A & B....read somewhere that its better to use it instead of A & B...but i dont remember why.
I've read that somewhere too, but I really don't see anything really bad about it. They use 2 variables instead of 1, if that would bother you (though those variables have to be initialized anyhow, whether you use them or not).

Status
Not open for further replies.

Replies
5
Views
751
Replies
5
Views
637
Replies
2
Views
779
Replies
3
Views
4K
Replies
6
Views
520