z-axis movement

I was wondering, how do I get my ship to move forwards? I was thinking input.getkey(w), but then what?

You can use as an example:

void Update(){
if(Input.getkey(Keycode.W)){
transform.Translate(Vector3.foward);
}
}

Any doubts give me a comment.