Drive motor hold when button pressed

Hi, I’m trying to make a code where if I press L1, the motors on my drive will hold. However with this code, It holds whenever the joystick value is 0, regardless if L1 is pressed or not. How would I make the motors coast/drive when L1 is not pressed?


int Drive() {
  
while(1) {

                if(Controller1.ButtonL1.pressing()) {
                    LeftFront.stop(brakeType::hold); 
}
       
               else {
                   LeftFront.spin(directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis1.value()) , velocityUnits::pct);
   
}
     vex::task::sleep( 20 );
}
     return(0);
}

use the http://help.vexcodingstudio.com/#cpp/namespacevex/classvex_1_1motor/setStopping

to set brake type to coast in the else portion of your code.