# While condition not taking values

**URL:** <https://discourse.nodered.org/t/while-condition-not-taking-values/45478>\
**Category:** General\
**Created:** [11 May 2021 08:46 UTC](https://discourse.nodered.org/t/while-condition-not-taking-values/45478 "2021-05-11T08:46:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Student00](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Student00](https://discourse.nodered.org/u/Student00)\
**Post date:** [11 May 2021 08:46 UTC](https://discourse.nodered.org/t/while-condition-not-taking-values/45478/1 "2021-05-11T08:46:36Z")

</div>

Hello, I have a weird problem where my while condition keeps saying that it cannot read the property I'm putting as a condition. The property I put a condition on is taken automatically with an http request node. Here are screenshots of my function and of the error:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/e/3e8a4abc9e68b8c6aa9e24776e0aacff882f9def.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b46643c2adb9189c940dd5615b1d49556dc1ecdb.png)

What I don't understand is why if I just replace the while function with an if function the code works just fine but the while cannot read the property

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 May 2021 09:12 UTC](https://discourse.nodered.org/t/while-condition-not-taking-values/45478/2 "2021-05-11T09:12:07Z")

</div>

Show us the code that use with `if` that works correctly.

**[Edit]** I presume you realise that `while` will repeatedly run the `shift` code until the test fails (or you get the error).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 July 2021 09:12 UTC](https://discourse.nodered.org/t/while-condition-not-taking-values/45478/3 "2021-07-10T09:12:31Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
