# For and While Loops

**URL:** <https://forum.dynamobim.com/t/for-and-while-loops/35441>\
**Category:** DesignScript\
**Created:** [May 1, 2019, 12:13am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441 "2019-05-01T00:13:54Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![BIMused](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@BIMused](https://forum.dynamobim.com/u/BIMused)\
**Post date:** [May 1, 2019, 12:13am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/1 "2019-05-01T00:13:54Z")

</div>

Can anyone tell me why I get no results for these two scripts…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/9/599c4fb6d6ee14ff5ddeeba5787c29756d6a3a6d.png)

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [May 1, 2019, 12:24am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/2 "2019-05-01T00:24:59Z")

</div>

@BIMused

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/c/9c1b28f955acc4d36be5acabe3ed8d3d6f30f498.png)

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [May 1, 2019, 12:30am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/3 "2019-05-01T00:30:09Z")

</div>

@BIMused Also read the following , item #6

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/4/a440f8ec44c3e3c57701e30efb6078dcd04f8017.png)

> **[DynamoDS/Dynamo](https://github.com/DynamoDS/Dynamo/wiki/Dynamo-2.0-Language-Changes-Explained)**
>
> Open Source Graphical Programming for Design. Contribute to DynamoDS/Dynamo development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![architectcoding](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/architectcoding/32/105118_2.png) [@architectcoding](https://forum.dynamobim.com/u/architectcoding)\
**Post date:** [May 1, 2019, 12:30am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/4 "2019-05-01T00:30:15Z")

</div>

As Salvo wrote, you forgot to return the list:

Here is a reference guide:

> **[DesignScriptGuide.pdf](https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf)**
>
> 343.24 KB

---

<div class="post-metadata">

**Author:** ![BIMused](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@BIMused](https://forum.dynamobim.com/u/BIMused)\
**Post date:** [May 1, 2019, 12:37am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/5 "2019-05-01T00:37:57Z")

</div>

Thanks Salvo!

---

<div class="post-metadata">

**Author:** ![BIMused](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@BIMused](https://forum.dynamobim.com/u/BIMused)\
**Post date:** [May 1, 2019, 12:39am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/6 "2019-05-01T00:39:01Z")

</div>

Thanks for that, I starting working through this guide…

[http://designscript.io/DesignScript\_user\_manual\_0.1.pdf](http://designscript.io/DesignScript_user_manual_0.1.pdf)

…I guess it’s a little dated?

---

<div class="post-metadata">

**Author:** ![architectcoding](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/architectcoding/32/105118_2.png) [@architectcoding](https://forum.dynamobim.com/u/architectcoding)\
**Post date:** [May 1, 2019, 12:55am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/7 "2019-05-01T00:55:58Z")

</div>

Haha, yeah, that one is version 0.1 while DesignScript has evolved to 2.1, just skimmed over it but won’t continue using it, as there are some outdated stuff like using curly braces for lists instead of square ones. There are many updated resources like the one Salvo posted or Dynamo Primer:

[https://primer.dynamobim.org/en/07\_Code-Block/7-2\_Design-Script-syntax.html](https://primer.dynamobim.org/en/07_Code-Block/7-2_Design-Script-syntax.html)

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [May 1, 2019, 1:21am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/8 "2019-05-01T01:21:54Z")

</div>

[https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf](https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf) should be updated for 2.1

---

<div class="post-metadata">

**Author:** ![BIMused](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@BIMused](https://forum.dynamobim.com/u/BIMused)\
**Post date:** [May 1, 2019, 1:34am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/9 "2019-05-01T01:34:58Z")

</div>

@architectcoding

Useful to work through to see how I can get the examples to run, here’s another one that has me stumped…

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/b/4bd06e61240f593b2f5ed339a0d1b440d133ff57.png)

…no return?

---

<div class="post-metadata">

**Author:** ![BIMused](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@BIMused](https://forum.dynamobim.com/u/BIMused)\
**Post date:** [May 1, 2019, 1:42am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/10 "2019-05-01T01:42:54Z")

</div>

ok I fixed it here…

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/626e3c7aba305091809a3a54824a6ac3e59643a0.png)

…so not sure why I can’t explicitly define p as a point type variable?

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [May 1, 2019, 2:00am UTC](https://forum.dynamobim.com/t/for-and-while-loops/35441/11 "2019-05-01T02:00:12Z")

</div>

thats a bug in imperative blocks, we have this tracked internally.
