Two errors always appear when I´m trying to start the game

Hello, so currently I am in SAFE MODE and the following two errors always appear then I´m trying to leave it:

Assets\NewBehaviourScript.cs(20,13): error CS0029: Cannot implicitly convert type ‘string’ to ‘bool’

Assets\NewBehaviourScript.cs(21,13): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

I don´t know what I´m doing wrong, this is the whole code:

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

public class NewBehaviourScript : MonoBehaviour
{
public float walk_speed = 0.5F;
private CharacterController _characterController;
public string use_key = “w”;

// Start is called before the first frame update
void Start()
{
    _characterController = gameObject.GetComponent<CharacterController>();
}

// Update is called once per frame
void Update()
{
    if( "w" ){
        this.transform.forward;
        _characterController.SimpleMove(Vector3.forward);
    }
}

}

Does someone know a solution?

Hi!

If you look at the error you’ll see Assets\NewBehaviourScript.cs(20,13) and . This will tell you the location of the errors, namely on line 20 and 21. They should also be highlighted red in whatever IDE you’re using (like visual studio).

The first error is this one:

if( "w" ){

The compiler has no idea what you’re talking about here, you probably want to use if(Input.GetKey("w")){ instead, assuming you want the code in the if statement to run while you’re holding the W key.

The next error is this line:

this.transform.forward;

The compiler is again confused, as you’re not storing or changing or doing anything with the transform. You can just remove this line of code.

Hope this helps!