Looping for a set amount of times.

I am guessing you are learning and just building your own sketches to verify you understand (basically, that is where I am).

the for loop works if you set it up as a function instead of inside the void loop.

so for example
void loop ()
{check for a button press,
if received
check the state
kick out to the function that handles that
}

function state1
{do stuff}

function state2
{do different stuff}

Your for loop would be setup in the function state1 or 2.
When the if loop is done, it would automatically return to void loop and look for another button press.

you might also want to look at debounce (search debounce arduino)
I had the issue of my button press being seen more than once changing my state rapidly. Originally I used a delay, but that basically just paused the program instead of keeping multiple button presses from occurring.