# Please tell me about the WhileLoop node

**URL:** <https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297>\
**Category:** DesignScript\
**Tags:** excel, dynamo\
**Created:** [December 14, 2020, 3:01am UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297 "2020-12-14T03:01:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![oh\_ruki](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@oh\_ruki](https://forum.dynamobim.com/u/oh_ruki)\
**Post date:** [December 14, 2020, 3:01am UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297/1 "2020-12-14T03:01:49Z")

</div>

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.

 ![スクリーンショット 2020-12-14 114928](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/1/a1ec362183e683ee1753533a1bae82c0f9176a6a.jpeg) ![スクリーンショット 2020-12-14 115005](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/1/c1776a1f8d0b01c0211b47720883c28afe639e69.png)

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [December 14, 2020, 6:41am UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297/2 "2020-12-14T06:41:46Z")

</div>

hi  
what is your desired result should be ?

---

<div class="post-metadata">

**Author:** ![oh\_ruki](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@oh\_ruki](https://forum.dynamobim.com/u/oh_ruki)\
**Post date:** [December 14, 2020, 7:03am UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297/3 "2020-12-14T07:03:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [December 14, 2020, 7:06am UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297/4 "2020-12-14T07:06:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![oh\_ruki](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@oh\_ruki](https://forum.dynamobim.com/u/oh_ruki)\
**Post date:** [December 14, 2020, 7:24am UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297/5 "2020-12-14T07:24:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [December 14, 2020, 10:05am UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297/6 "2020-12-14T10:05:25Z")

</div>

Hi,

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

> [@Looping a complex algorithm](https://forum.dynamobim.com/t/looping-a-complex-algorithm/56908/10):
>
> So… I found a solution. Don’t know if it’s the most elegant one but for my case it’s perfect. It’s a true loop solution, doesn’t use any python script and it’s all done with ootb dynamo nodes. Basically I made a custom node for the generation part. inside are: geometry generation, BIM elements generation, export and archive, erase all BIM elements. Inside the custom node the sequence of theese actions are managed by passthrough nodes (but you can do it in other ways)

Cheers,

Mark

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [December 14, 2020, 5:16pm UTC](https://forum.dynamobim.com/t/please-tell-me-about-the-whileloop-node/58297/7 "2020-12-14T17:16:23Z")

</div>

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;
i..e..s;

```

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