Please tell me about the WhileLoop node

I’m using a LoopWhile node.
As shown in the attached image, 1,2,3,4,5,6 is not accumulated in the output Excel.
I created a trial program this time to connect to what I want to do in the end, but can the LoopWhile node store data?
If the node cannot solve the problem, please teach us the description of DesignScript, Python, etc.

what is your desired result should be ?

Thank you for your reply.
I want to accumulate data on the same sheet as I repeat with LoopWhile.
In this case, I would like A1 to contain 1, A2 to 2, A3 to 3, A4 to 4, A5 to 5, and A6 to 6, but only 7,8,9 in the last list are output. not.
The program I finally create outputs various data calculated at one point to Excel, but since there are more than 100 points,
I want to use dynamo to perform loop processing such as outputting data at the first point, outputting data at the second point, and so on.

as i understand,
no need to use loop
just in excel node : make startrow (0) and the data after codeblock use flatten

I’m sorry, that’s not what I want to do.
Data is temporarily put in the list of List.GetItemAtIndex, but in reality, by inputting the numerical value output by LoopWhile as the index number into List.GetItemAtIndex, calculation is performed and various data is created each time.
This time, I want to know the mechanism of Loop processing, so I made it a simple program.


Here is an example of the loop while being used, hopefully it helps you understand it…



I don’t believe LoopWhile appends each consecutive output like you seem to be wanting. It just continues until the condition is not met and then stops.

There’s no need for LoopWhile to begin with though. You’re not really looping a function, you’re just counting. You can do this with a sequence instead.

i = 0;
e = 2;
s = 1;

This will give you a sequence from i to e counting by s (0, 1, 2).

1 Like