How to lerp values smoothly

So I am a beginner starting out on C# and I don’t really know much things but already googled and tried everything I could to know but I am trying to make when Shift is pressed the FOV should lerp from 1 value to another value to make it look nice than big value jumps

 if (Input.GetKeyDown(KeyCode.LeftShift))
        {                
                speed = RunSpeed;
                Camera.main.fieldOfView = Mathf.Lerp(70, 80, 2);

        }

        if (Input.GetKeyUp(KeyCode.LeftShift))
        {           
                speed = 3f;
                Camera.main.fieldOfView = Mathf.Lerp(80, 70, 2);
        }
  1. Cache the main camera in Start() method.

  2. It’s recommended to use Input.GetKey in this case.

  3. Must use Update()method.

  4. When lerping the first argument is always the value that you want to smooth.

    public float lerpSpeed = 1f;
    
    Camera mainCamera;
    
    bool startLerping;
    
    void Start()
    {
        mainCamera = Camera.main;
    }
    
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            startLerping = true;
    
        }
    
        if (Input.GetKeyUp(KeyCode.LeftShift))
        {
            startLerping = false;
        }
    
        if (startLerping == true)
        {
            mainCamera.fieldOfView = Mathf.Lerp(mainCamera.fieldOfView, 80, lerpSpeed * Time.deltaTime);
        }
        else
        {
           mainCamera.fieldOfView = Mathf.Lerp(mainCamera.fieldOfView, 70, lerpSpeed * Time.deltaTime);
        }
    }