Do while won't quit

I finally threw this into setup to make it stop. I am on Attiny so I can't debug my vars. noob

int buz = 3;
int j = 0;

void setup() {

pinMode(buz, OUTPUT);
delay(500); // no action for several seconds
do {
digitalWrite(buz, HIGH);
delay(10);
digitalWrite(buz, LOW);
delay(500);
j = j + 1;

} while (j < 3);

}

void loop() {

}

What gives

 delay(500); // no action for several seconds

is that an observation, or what you hoped would happen?

I finally threw this into setup to make it stop.

It stops in loop() as well, it is just that it starts up again immediately in loop(), the clue as to why is in the name of the function.

When it is in void loop()
Why does the global variable j reset itself to 0?

Why does the global variable j reset itself to 0?

Who said it does?

If I meet the conditional why does it sart over? Is j not incrementing?

Because "loop()" loops.

if j incremented to 3 and the loop started over isn't j still 3 and the while statement null. I want this thing to fire 4 times and stop.

rheine:
if j incremented to 3 and the loop started over isn't j still 3 and the while statement null. I want this thing to fire 4 times and stop.

Yes, but when you put

do {
...
}

it tells it to do it at least once, and then check for that condition.

OP: I think you're confusing a while loop with a do...while loop.
Look where the test and the increment are.

oooooh, OK thanks. I am used to do until

Do..while will always execute the body of the loop at least once because the test comes after the body.
A while loop tests before the body is executed.