# How to create a "while" function

**URL:** <https://forum.dynamobim.com/t/how-to-create-a-while-function/19969>\
**Category:** Revit\
**Created:** [March 13, 2018, 12:20pm UTC](https://forum.dynamobim.com/t/how-to-create-a-while-function/19969 "2018-03-13T12:20:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 13, 2018, 3:53pm UTC](https://forum.dynamobim.com/t/how-to-create-a-while-function/19969/2 "2018-03-13T15:53:55Z")

</div>

Section 12 of this document gives a good rundown on how to do it with design script. Likely best to start at the beginning and work your way to that point though.

> **[Dynamo\_language\_guide\_version\_1.pdf](https://dynamobim.org/wp-content/uploads/forum-assets/colin-mccroneautodesk-com/07/10/Dynamo_language_guide_version_1.pdf)**
>
> 1684.40 KB

I recently wrote a good example script utilizing these methods for multiple string replacement, which was posted here:

> [@String replace](https://forum.dynamobim.com/t/string-replace/19877/6):
>
> Personally I don’t like dictionaries for string replacement, as they tend to fall apart a bit due to the in-controllable nature of strings. Case in point if you were to look for the key “000110” you’d want to return “SK1,” but since there is no exact match for “000110” in the dictionary you receive null instead. This is not only not the intended result, but it introduces a change in data type as well. Simply put, with strings I feel that there are often too many wildcards to utilize dictionaries…

---

_[View the full topic](https://forum.dynamobim.com/t/how-to-create-a-while-function/19969)._
