While loop question

I have a related question to this same bit of code in this video:

float x = 0;
void setup(){
size(400,300);
}

void draw(){
background(0);

x=0;
while (x < width){
x=x+20;

fill(101);

stroke (255);
ellipse(x,150,16,16);
}

}

When it runs, it does this:

My question is, if x=0 at the start of the draw loop, why doesn’t the circle just draw at (20,150) and stop there?

Actually, through typing this out, I think I might have worked it out. Is it because x=0 isn’t inside the while loop? So it starts at 0, then the while loop fires until x > width?

OK, follow up question, why does it matter that x=0 is inside the draw loop when its already declared in the very first line at the top of the code? WIthout it inside the draw loop, it doesn’t draw a circle at all.

I think someone has maybe already answered this above but I’m really new to this (day 3) so I didn’t quite understand what they meant.

Thanks for your patience!