Newbie here, having problems with If Statements FIXED

I am making a three floor elevator powered by a stepper motor for my physics class. I have the user enter the desired floor through the serial monitor, but after the user inputs the motor does nothing. I think I’m just not using if statements correctly but honestly I have no idea what I’m doing.

All help much appreciated

here is my code

#include <AFMotor.h>


AF_Stepper motor(360, 2);

char gotolevel = 0;
int lvlN = 1;


void setup(){
  Serial.begin(9600);
  
  Serial.print("Enter A Floor ");
  
}

void loop(){
  while (Serial.available() > 0 ){
  Serial.print("while loop trigger ");
  gotolevel = Serial.read();
  Serial.print(gotolevel);
  Serial.println(" ");
  
  if(gotolevel == 2){
    if(lvlN == 1){
    motor.setSpeed(10);  // 10 rpm

    motor.step(180, BACKWARD, SINGLE);
    lvlN = 1;
    
    Serial.print("Going to level two");
    }
    if(lvlN == 2){
      Serial.print("Already here");
    }
    if(lvlN == 3){
    motor.setSpeed(10);  // 10 rpm

    motor.step(180, FORWARD, SINGLE);
    lvlN = 3;
    
    Serial.print("Going to level two");
    }
  }
  
  if(gotolevel ==  1){
    if(lvlN == 1){
      Serial.print("Already here");
    }
    if(lvlN == 2){
    motor.setSpeed(10);  // 10 rpm

    motor.step(180, BACKWARD, SINGLE);
    lvlN = 1;
    
    Serial.print("Going to level one");
    }
    if(lvlN == 3){
    motor.setSpeed(10);  // 10 rpm

    motor.step(360, BACKWARD, SINGLE);
    lvlN = 3;
    
    Serial.print("Going to level one");
    }
  }
  if(gotolevel == 3){
      if(lvlN == 1){
     motor.setSpeed(10);  // 10 rpm

     motor.step(360, FORWARD, SINGLE);
     lvlN = 3;
    
    Serial.print("Going to level three");
        }
        if(lvlN == 2){
        motor.setSpeed(10);  // 10 rpm

        motor.step(180, FORWARD, SINGLE);
        lvlN = 3;
        
        Serial.print("Going to level three");
        }
        if(lvlN == 3){
        Serial.print("Already here");
        }
        
          Serial.print("Enter A Floor ");
    }
}
}

after the user inputs the motor does nothing

But what do the debug prints tell you?

Use the auto formatter and then look at the logic again!.

Mark

Fixed it, I was a complete moron and for got that my gotolevel was a char, fixed by putting '1', '2' and '3' in the if statemnts.