Make an led blink a specific amount of times in void-loop?

BWD teaches how to make something happen on time using an if() inside of loop() that goes around and around.

When you can make something happen based on a time event then you can make something happen based on an input (button or sensor) or accumulation of factors that change a variable or variables or combination of any of those.

So you divide what you want the sketch to do into stages or process states or whatever you want to call them and determine the triggers for each. If something has to wait then end one stage setting up for the next by setting the wait start and interval and start the next with the time check, if (now - start >= interval). To get each stage to run, use a variable and have each stage change that when it is finished and the next should run.

If I should have it blink 5 times then I'd need to set up a blink countdown (so the blink code isn't stuck with 5) and the time variables and then set the stage to run the blink code that uses those. When it's done, change the stage and whatever else needs changing.

But first, learn BlinkWithoutDelay or learn from this more well-explained blog on Arduino multi-tasking: