# Trouble With While Function

**URL:** <https://forum.kirupa.com/t/trouble-with-while-function/643559>\
**Category:** Uncategorized\
**Created:** [July 15, 2020, 12:01am UTC](https://forum.kirupa.com/t/trouble-with-while-function/643559 "2020-07-15T00:01:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Stern](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/john_stern/32/12050_2.png) [@John\_Stern](https://forum.kirupa.com/u/John_Stern)\
**Post date:** [July 15, 2020, 12:01am UTC](https://forum.kirupa.com/t/trouble-with-while-function/643559/1 "2020-07-15T00:01:30Z")

</div>

## var x = 0; while(x \< 390) { textSize(20); fill(0, 119, 255); text(x,x,0); x = x + 50; }

the above code is supposed to be a shorthand for the code you see below and it is supposed to give me the same result as you see in the diagram on the right side of the image - a row of numbers across the top of the window - but I get nothing - any idea where I am going wrong?

 ![Screen Shot 2020-07-14 at 4.52.20 PM](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/e/e674c633b3bf9c89dc6b3b75c754ad3267cd2333.png)

I don’t see an image here so I’m not sure it got uploaded.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 15, 2020, 12:34am UTC](https://forum.kirupa.com/t/trouble-with-while-function/643559/2 "2020-07-15T00:34:50Z")

</div>

You have a bunch of things that don’t match up, such as fill() being different (you only need to call this once outside of the loop), textSize() is being used which wasn’t before, and you’re not passing in 10 (which should be 20 to match the new text size now) to bring the text down. The last one is probably why you’re not seeing anything. Text is drawn from the bottom up, more or less, so with using 0 for the 3rd argument of text() is going to cause the text to be drawn off screen. Changing that to a 20 should help.

---

<div class="post-metadata">

**Author:** ![John\_Stern](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/john_stern/32/12050_2.png) [@John\_Stern](https://forum.kirupa.com/u/John_Stern)\
**Post date:** [July 15, 2020, 3:07pm UTC](https://forum.kirupa.com/t/trouble-with-while-function/643559/3 "2020-07-15T15:07:10Z")

</div>

Yes indeed that did help - very nice analysis of the problem - in fact it did solve the issue - thanks !
