Boolean Errors

Error:

Expressions in statements must only be executed for their side-effects.

Script:

var pressed : boolean = false;

function OnMouseDown () {

audio.Play();

if (pressed == true) {
Application.Quit();

	}
}

function OnMouseUp () {

pressed == true;
renderer.material.color = Color.red; 
audio.Play();

}

Question:

Why?

EDIT:

I DID Google it but I didn’t get an answer I could understand. Thanks for anyone who can help.

function OnMouseUp () {

    pressed == true; // THIS IS MEANINGLESS
    renderer.material.color = Color.red; 
    audio.Play();
 
}

you meant to do pressed = true; A single ‘=’ is the assignment operator. I stores the value ‘true’ in the variable ‘pressed’. ‘==’ is the equivalency operator. It compares ‘pressed’ and ‘true’ and returns the result.

Line 15 of your script should be

pressed = true;

You only use 1 equals sign when you are assigning a value to a variable