How to rotate 90 degrees

function Update() {

if(Input.GetKeyDown("D")) {
     transform.rotate += 90
}

I’m not actually in unity right now but I just wanted to know if it would look something like this. I’m working on a project for a game for the blind.

It depends what exactly you want it to do. If you just want it snap to 90 degrees, with no smoothing, then this is what your code should look like

if (Input.GetKeyDown(KeyCode.D)) {
	transform.Rotate(0, 90, 0);	
}

You are not specifying the Vector or the axis… So what you want to rotate?

Try this X,Y,Z

if (Input.GetKeyDown ("3")){
     transform.Rotate(Vector3(0,90,0));
}