how do i rotate an object? C#

hello, i’m new to unity and i’m trying my best to get things work fine. after watching some tutorials i ended up having this code:

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

public class cmovement : MonoBehaviour {

public KeyCode PressUp;
public KeyCode PressDown;
public KeyCode PressLeft;
public KeyCode PressRight;

// Use this for initialization
void Start () {
	
}

// Update is called once per frame
void Update () {
	if (Input.GetKeyDown (PressUp))
		transform.Rotate(Vector3.right, Time.deltaTime);
		
}

}

so i assigned the W key to the variable PressUp, aaaaand it doesn’t work. i wonder why

Try this

using UnityEngine;
using System.Collections;

public class RotateObject : MonoBehaviour {
	
	// Update is called once per frame
	void Update () {
	    if (Input.GetKey(KeyCode.UpArrow))
        {
            transform.Rotate(Vector3.right);
        }
	}
}

Check out keycodes and different types of input to gain greater understanding and avoid future mistakes, if you have any questions feel free to ask

Input - Unity - Scripting API: Input
Keycodes - Unity - Scripting API: KeyCode