# If else statement not working

**URL:** <https://discourse.processing.org/t/if-else-statement-not-working/12325>\
**Category:** Coding Questions\
**Created:** [June 26, 2019, 8:35pm UTC](https://discourse.processing.org/t/if-else-statement-not-working/12325 "2019-06-26T20:35:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julan](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@julan](https://discourse.processing.org/u/julan)\
**Post date:** [June 26, 2019, 8:35pm UTC](https://discourse.processing.org/t/if-else-statement-not-working/12325/1 "2019-06-26T20:35:47Z")

</div>

hey,  
I am a beginner and wanted to made this sketch of a ball that squishes before it bounces back, hover it doesn’t squisches at al and I don’t get the squishing part of the sketch to work without removing all of the movement. Does anyone know what I am doing wrong?

this is a link to my sketch: [https://editor.p5js.org/julan/sketches/kWq1q7gJJ](https://editor.p5js.org/julan/sketches/kWq1q7gJJ)

---

<div class="post-metadata">

**Author:** ![tribblesontoast](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@tribblesontoast](https://discourse.processing.org/u/tribblesontoast)\
**Post date:** [June 27, 2019, 12:49am UTC](https://discourse.processing.org/t/if-else-statement-not-working/12325/2 "2019-06-27T00:49:42Z")

</div>

Hi julan,  
Take a look at line 23. You are checking if the x size of the ellipse is larger than the canvas width. This isn’t going to have the effect you want.

Happy coding.

---

<div class="post-metadata">

**Author:** ![julan](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@julan](https://discourse.processing.org/u/julan)\
**Post date:** [June 27, 2019, 6:04am UTC](https://discourse.processing.org/t/if-else-statement-not-working/12325/3 "2019-06-27T06:04:20Z")

</div>

yes, that solved the problem. Thank you verry much
