error CS1525: unexpected symbol. How do I fix this and why am I getting this error?

I’m very new to coding in general and I am using C#
I’m trying to make it so when you press W the sprite (which is in a 2D space) moves up
I’m getting an error CS1525 unexpected symbol “transform”

using UnityEngine;
using System.Collections;

public class PlayerHandler : MonoBehaviour 
{

	float speed = 1.0f;

	// Initialization
	void Start () 
	{
	
	}
	
	// Update
	void Update () 
	{
		if (Input.getkey(KeyCode.W)
			transform(Vector3.forward * speed * Time.deltaTime);
	}
}

If you are just starting out with Unity we suggest checking out the learn section, as there exists several tutorials, documentation and live training sessions. Specifically, if you need to learn about programming then please go through the scripting tutorials.

In this case the error you got is because of the line

if (Input.getkey(KeyCode.W)

Where the second parenthesis are not closed. Your computer then continues to read the next line, expecting it to finish the true/false condition and realizes that the symbol transform is not being used as part of the conditional hence the error unexpected symbol “transform”.

Then the next line also has an error as you use an object as a function when as explained above you should be adjusting the position of the transform. An alternative to setting position would be to use Transform.Translate.

So your code should be

     if (Input.getkey(KeyCode.W))
         transform.Translate(Vector3.forward * speed * Time.deltaTime);