28BJY Stepper Motor and Limit Switch

I have made a simple project which drives the motor steps as I have given and could also attach limit switch from where the program starts and works fine
But when the program is interrupted I want the motor to come to the limit switch where I have stuck

I am very new to coding Please help

my code is as follows...

#include <Stepper.h>
#include <ezButton.h>
Stepper stepper1(2048, 2, 4, 3, 5);
ezButton button1(6);
void setup() {
  Serial.begin(9600);
  stepper1.setSpeed(15);
}
void loop() {
  button1.loop();
  int btn1State = button1.getState();
  Serial.print("Button 1 State = ");
  Serial.println(btn1State);

  if (btn1State == 0) {
    for (int i = 0; i <= 10; i++) {
      stepper1.step(675);
      delay(500);
    }

    stepper1.step(-7425);
  }
}

You will have to tell us what you mean here. We can't read your mind.

Extremely sorry for inconvenience
What I mean is if the program gets reset in between the motor should go to the limit switch and start the loop again
I have made one change and that is working but as am very much new to programming I just wanted to know if I am on right track or not

I have added another if statement and it is working please help me if there are any better ways to do it
Thank you very much for quick reply

my new code is

#include <Stepper.h>
#include <ezButton.h>
Stepper stepper1(2048, 2, 4, 3, 5);
ezButton button1(6);
void setup() {
  Serial.begin(9600);
  stepper1.setSpeed(15);
}
void loop() {
  button1.loop();
  int btn1State = button1.getState();
  Serial.print("Button 1 State = ");
  Serial.println(btn1State);
  if (btn1State == 1) {
    stepper1.step(-10);
  }
  if (btn1State == 0) {
    for (int i = 0; i <= 10; i++) {
      stepper1.step(675);
      delay(500);
    }
    stepper1.step(-7425);
  }
}

presumably the limit switch is at one end of the motor rotation and represents step position 0

from an unknown position, the motor should be able to be rotated either clockwise or counter-clockwise toward the limit switch. on startup, rotate the motor one step at a time in that direction until it reaches the limit switch, stop the motor and reset the position to zero

This is where the code to find the limit switch belongs. Long before the loop() begins it's processing. Then you will ALWAYS find the limit before anything else.
Paul

Thanks a lot, I will let you know when i update acording to your suggestion, it is bedtime now
Thanks once again.