Coding noob

Hi everyone! I haven't played with my arduino in awhile and became interested in stepper motors recently. Basically, my question whats the best way or approach in writing an if statement in an if statement.

My thought so far is that I hit a push button and my motor will move a small platform backwards till it hits a limit switch. Once the limit switch is pressed, it will move forward a specified amount.

i'm thinking

void loop()
{

if (buttonState1 == HIGH)
{
//some code to move motor backwards forever
if (limitswitchstate1 == HIGH)
{
// some code to move motor forward specified amount
}
}
}

I want the motor to move back basically forever UNTIL the limit switch is pressed then it will move forward my specified amount. will something like this work properly?

In addition to KE7GKP's suggestions, I would also suggest that you look into implementing the process as a state machine (instead of straight if-then constructs); doing so (properly) will keep the code easier to read and maintain.