# Printing the y coordinate is "undefined"

**URL:** <https://discourse.processing.org/t/printing-the-y-coordinate-is-undefined/21158>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [May 22, 2020, 5:36am UTC](https://discourse.processing.org/t/printing-the-y-coordinate-is-undefined/21158 "2020-05-22T05:36:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nis](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@Nis](https://discourse.processing.org/u/Nis)\
**Post date:** [May 22, 2020, 5:36am UTC](https://discourse.processing.org/t/printing-the-y-coordinate-is-undefined/21158/1 "2020-05-22T05:36:22Z")

</div>

![Screenshot_2020-05-22-11-00-37-479_com.android.chrome](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8b9d11ef6fce0c24b61a425bb102708bfbb9bead.jpeg)

The above the picture of my code, where it isn’t printing the y coordinate of the moving rectangles, instead it is printing “undefined”

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [May 22, 2020, 9:59am UTC](https://discourse.processing.org/t/printing-the-y-coordinate-is-undefined/21158/2 "2020-05-22T09:59:56Z")

</div>

Did you init the values ? In a for loop?

---

<div class="post-metadata">

**Author:** ![Nis](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@Nis](https://discourse.processing.org/u/Nis)\
**Post date:** [May 22, 2020, 10:33am UTC](https://discourse.processing.org/t/printing-the-y-coordinate-is-undefined/21158/3 "2020-05-22T10:33:29Z")

</div>

[https://editor.p5js.org/Nis\_Collect/sketches/U0p3GjOK1](https://editor.p5js.org/Nis_Collect/sketches/U0p3GjOK1)

You can check my code from the above link and compare to the picture which I had uploaded before, please…

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 22, 2020, 11:42am UTC](https://discourse.processing.org/t/printing-the-y-coordinate-is-undefined/21158/4 "2020-05-22T11:42:56Z")

</div>

For context this topic continues from here:

> [@Collision of the player with the moving rectangles](https://discourse.processing.org/t/someone-please-help-me-in-solving-a-simple-problem-which-i-am-stuck-with/21124):
>
> [https://editor.p5js.org/Nis\_Collect/sketches/U0p3GjOK1](https://editor.p5js.org/Nis_Collect/sketches/U0p3GjOK1) Given above is the link of my project. Someone please help me by reviewing my code and telling me that how can I confirm the collision of the player with the moving rectangles. Please provide me the code of only the lines which specifies the collision of the player and the moving blocks. I tried so many ways but I can’t figure it out. Please please help me.

Resources for programming with P5,js:  
https://www.youtube.com/embed/videoseries?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA&wmode=transparent&rel=0&autohide=1&showinfo=1&enablejsapi=1

`:)`
