How to stop camera from rotating to much

I have some basic code that lets you look around but it lets you rotate all the way upside down I want it to still be able to rotate up and left and right though.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraMove : MonoBehaviour
    public float SpeedH = 2.0f;
    public float SpeedV = 2.0f;

    private float yaw = 0.0f;
    private float pitch = 0.0f;

    private void Start()
        Cursor.visible = false;

    void Update()
        yaw += SpeedH * Input.GetAxis("Mouse X");
        pitch -= SpeedV * Input.GetAxis("Mouse Y");

        transform.eulerAngles = new Vector3(pitch, yaw, 0.0f);


Why not just cap the pitch between -90 and 90 with Mathf.Clamp()?

You can clamp it or you can use lerp on camera rotation and it will smoothly adjust to the rotation you want ( Or even better use combination of both functions. )