Hi I am new to Unity and I are building a racing car game This is my problem: error CS0023: The `! ' operator can not be applied to operand of type `float ' Please guide me how can I fix this My problem on line 11

public WheelCollider W_FL;
public WheelCollider W_FR;
public WheelCollider W_RL;
public WheelCollider W_RR;
private float V;
private float H;
private int M_Speed = 30;
private int T_Speed = 150;
public float C_Speed;
void FixedUpdate () {
if (!V)
{
W_RL.brakeTorque = 100;
W_RR.brakeTorque = 100;
}
else {
W_RL.brakeTorque = 0;
W_RR.brakeTorque = 0;
}
C_Speed = 2 * 3.14f * W_RL.radius * W_RL.rpm * 60 / 1000;
C_Speed = Mathf.Round (C_Speed);

		if (C_Speed < T_Speed  && C_Speed > -30) {

    	W_RL.motorTorque = M_Speed * V;
		W_RR.motorTorque = M_Speed * V;
		} 
		else {
			W_RL.motorTorque = 0;
			W_RR.motorTorque = 0;
				}
	}
	void Update () {
		V = Input.GetAxis("Vertical");
    }

The error says that you cannot apply the ! operator to a variable of type float. You have if (!V), where you are applying the ! operator to the variable V, which you earlier declared as a variable of type float, which you can’t do, as the error message tells you. Floats have a complicated binary representation and can’t be interpreted as a boolean value, and ! can only apply to bools or types that can be interpreted as bools.

Judging from the rest of your code, you want if (V == 0F) or something similar.

You cannot apply the operator like that. You are saying, “If V is Not…” because V is a float. It has no parameters beyond it’s value. The operator you are using is commonly used for bools.