# For loops not working as expected in Postman

**URL:** <https://community.postman.com/t/for-loops-not-working-as-expected-in-postman/35140>\
**Category:** Help Hub\
**Created:** [May 9, 2022, 12:09pm UTC](https://community.postman.com/t/for-loops-not-working-as-expected-in-postman/35140 "2022-05-09T12:09:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lindbach](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@Lindbach](https://community.postman.com/u/Lindbach)\
**Post date:** [May 9, 2022, 12:09pm UTC](https://community.postman.com/t/for-loops-not-working-as-expected-in-postman/35140/1 "2022-05-09T12:09:12Z")

</div>

Hello,

Im using postman and need for loops in both pre-scripts and tests. This is because responses are changing a lot, and they’re SOAP XML. Anyway, i use for loops but they dont work as they dont loop.

See screenshot, the loop will only print out 0, and not the following integers. Is this a bug or what am i experiencing here?

 ![forloop](https://us1.discourse-cdn.com/getpostman/original/2X/3/32eb74e930743af88ea1e3c3d064e4258a492390.png)

---

<div class="post-metadata">

**Author:** ![joint-operations-ar3](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/joint-operations-ar3/32/11690_2.png) [@joint-operations-ar3](https://community.postman.com/u/joint-operations-ar3)\
**Post date:** [June 29, 2022, 4:27am UTC](https://community.postman.com/t/for-loops-not-working-as-expected-in-postman/35140/2 "2022-06-29T04:27:14Z")

</div>

Check console. It may be your following line is breaking for i=1 (You can comment and try running the loop… It prints all i’s properly)  
//let actualspeed = …
