How would I go about making my object switch between positions ?

I am in the process of making a futuristic 2.5D game viewed from the side. The ship moves forward automatically and moves up everytime ipress spacebar but I am wondering how would igo about making the ship only able to move up twice then back to the bottom lane. So in other words there are 3 lanes. At the moment my ship just continuously jumps up everytime ipress spacebar.

Here is one way to do what you want:

#pragma strict

private var heights = new float[3];
private var iCurr = 0;

function Start() {
	heights[0] = transform.position.y;
	heights[1] = transform.position.y + 40.0;
	heights[2] = transform.position.y + 80.0;
function Update () {
	if(Input.GetKeyDown(KeyCode.Space)) {
		iCurr = (iCurr + 1) % 3;
		transform.position.y = heights[iCurr];