cant figure out how to latch output

i want the .....

digitalWrite(LED_BUILTIN, LOW);
analogWrite(EDS4, 0);

.......to stay off/low even with no ......

while (digitalRead(gearin1) == true )

......input. but when a new input is LOW then disregard that section of code.

i have been reading and searching since 8 this morning.
i have tryed some "while" and "if" stuff but cant get this latching

int gearin1 = A0;                            // six SHIFT INPUTS LOW/ACTIVCE  
int gearin2 = A1;
int gearin3 = A2;
int gearin4 = A3;
int gearin5 = A4;
int gearin6 = A5;
int EDS1= 3;                             // solenoid  outputS
int EDS2= 5;    
int EDS3= 6;    
int EDS4= 9;    
int EDS5= 10; 
int MV1 = 2;   

void setup() 
{
 pinMode(gearin1, INPUT_PULLUP);              // shift switch inputs
 pinMode(gearin2, INPUT_PULLUP);  
 pinMode(gearin3, INPUT_PULLUP);  
 pinMode(gearin4, INPUT_PULLUP);
 pinMode(gearin5, INPUT_PULLUP);  
 pinMode(gearin6, INPUT_PULLUP); 
 
 bool gearin1 = false;                     //for first gear
 
 pinMode(EDS1, OUTPUT);                   // solenoid outputs
 pinMode(EDS2, OUTPUT);
 pinMode(EDS3, OUTPUT);
 pinMode(EDS4, OUTPUT);
 pinMode(EDS5, OUTPUT); 
 pinMode(MV1,  OUTPUT); 
 pinMode(LED_BUILTIN, OUTPUT);
}

void loop(){                                             
                                               // FIRST GEAR                                           
while  (digitalRead(gearin1) == true ) 
       
    {
     analogWrite(EDS1, 240);
     analogWrite(EDS2, 240);
     analogWrite(EDS3, 0);
     analogWrite(EDS4, 240);
     analogWrite(EDS5, 0); 
     digitalWrite(MV1,  LOW);
    digitalWrite(LED_BUILTIN, HIGH);
    
    delay (2000);
    
    digitalWrite(LED_BUILTIN, LOW);
    analogWrite(EDS4, 0);
    
    }

Once statements like the following have been executed, no further action is required. The outputs remain as commanded.

digitalWrite(LED_BUILTIN, LOW);
analogWrite(EDS4, 0);

For more informed help, make an effort to more clearly describe what you are trying to accomplish.

when i have A0 low, it will keep running through the section of code until i let A0 go high.then the final bit with .....

digitalWrite(LED_BUILTIN, LOW);
analogWrite(EDS4, 0);

will execute.

i believe it is running the pre delay portion over and over right?

Sorry, I have no idea what you are talking about.

What do you want the program to do?

i start with gearin1/A0 low

then i need to have PWM pins 3,5,9 go high

and then after about 500 milliseconds let PWM pin 9 go high

and then stay in that condition until another different gearin is selected. even if gearin/A0 pin gets toggles for any reason
the built in led is just a visual of what the pin 9 is doing....

i start with gearin1/A0 low

No, you don't. You start with pin A0 in an unknown state.

The loop function then enters a while loop that reads the A0 input and does some things if A0 happens to be HIGH, but mostly just wastes time for two seconds each pass.

another day tryiing down............

As @jremington notes you seem to think this

int gearin1 = A0;                            // six SHIFT INPUTS LOW/ACTIVCE

is somehow setting the state of a pin HIGH or LOW. It isn't. We don't know what that pin is connected to, might be ground, might be Vcc, might be floating.

Then your code comes along and says

while  (digitalRead(gearin1) == true )

Well. If you are not getting the results you want then you might consider that digitalRead(gearin1) is not in that state.

thanks for the reply
i have been vigorously editing and hopefully getting better

int gearin1 = A0;

is later defined as a

pinMode(gearin1, INPUT_PULLUP);

right?

anyways my latest code
i want the 6 seperate outputs to remain active even after the analog input has changed to HIGH

const int gearin1 = A0;                            //  SHIFT INPUTS LOW/ACTIVCE
const int gearin2 = A1;
const int gearin3 = A2;
const int gearin4 = A3;
const int gearin5 = A4;
const int gearin6 = A5;
const int EDS1 = 3;                                 // solenoid  outputS
const int EDS2 = 5;
const int EDS3 = 6;
const int EDS4 = 9;
const int EDS5 = 10;
const int MV1 =11;

int lastgear1;

void setup()
{
  pinMode(gearin1, INPUT_PULLUP);              // shift switch inputs
  pinMode(gearin2, INPUT_PULLUP);
  pinMode(gearin3, INPUT_PULLUP);
  pinMode(gearin4, INPUT_PULLUP);
  pinMode(gearin5, INPUT_PULLUP);
  pinMode(gearin6, INPUT_PULLUP);
  pinMode(EDS1, OUTPUT);                       // solenoid outputs
  pinMode(EDS2, OUTPUT);
  pinMode(EDS3, OUTPUT);
  pinMode(EDS4, OUTPUT);
  pinMode(EDS5, OUTPUT);
  pinMode(MV1,  OUTPUT);
  lastgear1 = digitalRead(gearin1);
}

void loop() {

  int gearnow1 = digitalRead(gearin1);
  
  if (digitalRead(gearin1) == LOW  &&            // FIRST GEAR
      digitalRead(gearin2) == HIGH  &&
      digitalRead(gearin3) == HIGH &&
      digitalRead(gearin4) == HIGH &&
      digitalRead(gearin5) == HIGH &&
      digitalRead(gearin6) == HIGH )
  {
    analogWrite(EDS1, 240);
    analogWrite(EDS2, 240);
    analogWrite(EDS3, 0);
    analogWrite(EDS4, 240);
    analogWrite(EDS5, 0);
    analogWrite(MV1,  0);
    
    delay (200);
    
    analogWrite(EDS4, LOW); 
    while (digitalRead(gearin1) == LOW);
     lastgear1 = gearnow1;
    }
  
  
  if  (digitalRead(gearin1) == HIGH  &&                  // SECOND GEAR
       digitalRead(gearin2) == LOW  &&
       digitalRead(gearin3) == HIGH &&
       digitalRead(gearin4) == HIGH &&
       digitalRead(gearin5) == HIGH &&
       digitalRead(gearin6) == HIGH )
  {
    analogWrite(EDS1, 240);
    analogWrite(EDS2, 240);
    analogWrite(EDS3, 240);
    analogWrite(EDS4, 240);
    analogWrite(EDS5, 0);
    analogWrite(MV1,  240);
  }
  if  (digitalRead(gearin1) == HIGH &&                // THIRD GEAR
       digitalRead(gearin2) == HIGH &&
       digitalRead(gearin3) == LOW  &&
       digitalRead(gearin4) == HIGH &&
       digitalRead(gearin5) == HIGH &&
       digitalRead(gearin6) == HIGH )
  {
    analogWrite(EDS1, 0);
    analogWrite(EDS2, 0);
    analogWrite(EDS3, 0);
    analogWrite(EDS4, 240);
    analogWrite(EDS5, 0);
    analogWrite(MV1,  0);
  }
  if (digitalRead(gearin1) == HIGH  &&               // FOURTH GEAR
      digitalRead(gearin2) == HIGH &&
      digitalRead(gearin3) == HIGH &&
      digitalRead(gearin4) == LOW  &&
      digitalRead(gearin5) == HIGH &&
      digitalRead(gearin6) == HIGH )
  {
    analogWrite(EDS1, 240);
    analogWrite(EDS2, 240);
    analogWrite(EDS3, 0);
    analogWrite(EDS4, 0);
    analogWrite(EDS5, 0);
    analogWrite(MV1,  240);

  }
  if (digitalRead(gearin1) == HIGH  &&               // FIFTH GEAR
      digitalRead(gearin2) == HIGH &&
      digitalRead(gearin3) == HIGH &&
      digitalRead(gearin4) == HIGH &&
      digitalRead(gearin5) == LOW  &&
      digitalRead(gearin6) == HIGH )
  {
    analogWrite(EDS1, 0);
    analogWrite(EDS2, 0);
    analogWrite(EDS3, 0);
    analogWrite(EDS4, 0);
    analogWrite(EDS5, 0);
    analogWrite(MV1,  240);
  }
  if (digitalRead(gearin1) == HIGH  &&               // SIXTH GEAR
      digitalRead(gearin2) == HIGH &&
      digitalRead(gearin3) == HIGH &&
      digitalRead(gearin4) == HIGH &&
      digitalRead(gearin5) == HIGH &&
      digitalRead(gearin6) == LOW  )
  {
    analogWrite(EDS1, 0);
    analogWrite(EDS2, 240);
    analogWrite(EDS3, 240);
    analogWrite(EDS4, 0);
    analogWrite(EDS5, 0);
    analogWrite(MV1,  240);
  }
}