# Coding Train Tutorial 6.2 while loop question

``````
float y=0;
float x=0;
void setup() {
size(800, 800);
}

void draw()
{
background(200, 20, 90);

y=0;
while (y<height) {
if (mouseY<1) {
y=y+1;
} else {
y=mouseY+y;
}
}
//x=x+40;

fill(200);
ellipse(x, y, 30, 30);
}
``````

same as the video did but just change to the y value. what’s the thing that was wrong and how will I improve the thinking structure skill or imaging code?( very beginner question, and I realize the reason I couldn’t make things right is because my "structure of problem solving " is wrong.

Hi @Siyue,

What are you trying to do precisely? Can you link the video / original link that you are talking about?

The `mouseY` value is the `y` coordinate of the mouse in the canvas. So if your canvas is 800x800 pixels, then `mouseY` will be between 0 and (800 - 1) pixels. Therefore the above condition will rarely be true since `1` is really small.

1 Like

Also this will cause `y` to get very big very quickly

You need to ba able to see the values of x and y as the program runs add the statement
`println(x,y); `inside the draw() method like this

``````void draw()
{
background(200, 20, 90);

y=0;
while (y<height) {
if (mouseY<1) {
y=y+1;
} else {
y=mouseY+y;
}
}
println(x,y);  // see what is happening
``````