How do I switch a variable each time I hit a key?

I have a variable, recordVideo : boolean = false. What I would like to do is be able to toggle the state of this variable each time I hit say the left mouse button (KeyCode.Mouse0). Right now I am using Input.GetKey, but I have to hold the mouse button down to make recordVideo true and release it to make it false.

Use GetKeyDown instead of GetKey. Also, there's a neat way of toggling a boolean - see below:

function Update () {
    if (Input.GetKeyDown(yourKeycode))
    {
        recordVideo = !recordVideo;
    }
}

Just a sitenote, there are also if statements that you can use to switch variables (like if they are not bool):

variable = (variable == 0) ? 5 : 0;

this will return 5 if variable was 0 before, or 0 if variable is not 0 before.