Breaking out of loop when it shouldn't

I am having problems with a loop in my program. The idea is that the loop happens until the time runs out, but if a button is pressed it leaves the loop right then. The loop runs fine without the button check, but doesn’t run with the button check. I am not sure what I am doing wrong. Have checked that the switch is ‘1’ when on and ‘0’ when off and that is fine, just seems to be the IF statment that is fouling up. Any help would be greatly appriciated!

  while (cpr_time < dly_time)
    cpr_time = millis() - old_time;
    rstswitch = digitalRead(rstsw);
    if (rstswitch = 1) {break;}

Sorry just noticed this is in the HW section not SW :-[

Darn, school boy error :-[ I forgot the == in the IF rather then = that I was doing. Stupid stupid me!