4 Directional Movement

Hey there,

I’m in the process of making my first game and right now im working on a 4-D movement.
here is what i have:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

	public float speed;

	void Update () {

		if(Input.GetKey(KeyCode.D) ){
			transform.Translate (Vector2.right * speed);
		}

		if(Input.GetKey(KeyCode.A) ){
			transform.Translate (Vector2.left * speed);
		}

		if(Input.GetKey(KeyCode.S) ){
			transform.Translate (Vector2.down * speed);
		}

		if(Input.GetKey(KeyCode.W) ){
			transform.Translate (Vector2.up * speed);
		}
	}
}

I’m sure it is not the best solution ( since i have been following a year old tutorial).
With this im still able to go up-right, up-left, and so on. Is there any way to disable this movement? I’m new to coding and everything so please dont be to complex( or too harsh). Thanks!

Change:

if...
if...
if...
if...

To:

if...
else if...
else if...
else if...

So that only the first key pressed down will be considered.