# Access to a class variable

**URL:** <https://discourse.processing.org/t/access-to-a-class-variable/35883>\
**Category:** Coding Questions\
**Created:** [March 21, 2022, 7:22pm UTC](https://discourse.processing.org/t/access-to-a-class-variable/35883 "2022-03-21T19:22:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cthulhu](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@Cthulhu](https://discourse.processing.org/u/Cthulhu)\
**Post date:** [March 21, 2022, 7:22pm UTC](https://discourse.processing.org/t/access-to-a-class-variable/35883/1 "2022-03-21T19:22:12Z")

</div>

Hello, I want to acess to a class variable but I can´t. How do I do it?  
\</if (dist(xpos,ypos,balls.xpost,balls.ypost)\<=0){

> 

}

Class name is Ball

---

<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:** [March 24, 2022, 1:23pm UTC](https://discourse.processing.org/t/access-to-a-class-variable/35883/2 "2022-03-24T13:23:10Z")

</div>

> [@Cthulhu](#):
>
> balls.xpost

This looks pretty good, maybe a typo

ball.xpos?

Show your entire code, when balls is an array it looks different
