Input.GetKeyDown() is not working

PS : - I am using the old Input system.
So I was creating the input and movement scripts for my game, when during testing I realized that the player could jump but not move. Using Debug.Log(), I narrowed the problem down to a single if statement. Here’s the code I’m using.

    [SerializeField] KeyCode jump = KeyCode.Space;
    [SerializeField] KeyCode sprintKey = KeyCode.LeftShift;
    [SerializeField] KeyCode crouchKey = KeyCode.LeftControl;
    public float xInput;
    public bool jumpPressed;
    public Enums.MovementState movementState;

void Update()
        xInput = Input.GetAxis("Horizontal"); //This is working.

        if (Input.GetKey(jump)) { jumpPressed = true; } //This is working.

        //This is not working.
        if (Input.GetKeyDown(sprintKey)) 
            Debug.Log("Left Shift is pressed."); //Not logging.
            movementState = Enums.MovementState.Sprinting;
        else if (Input.GetKeyDown(crouchKey)) 
            Debug.Log("Left Control is pressed."); //Not logging.
            movementState = Enums.MovementState.Crouching;
            Debug.Log("Neither Left Shift nor left Control is pressed."); //Not logging.
            movementState = Enums.MovementState.Walking;

Does anybody know how to solve this problem?

Input.GetKeyDown (or Input.GetButtonDown in later versions) only detects when you press it and not when it is being held down. You would likely need to use Input.GetKey for your sprint button, since it will likely continue to be held down.
Then again, I am a Unity n00b at the moment, so don’t quote me.

Have you tried not using else ?