Cubed movement

How can I move a character in a cube-like movement that moves 1 unit when you hold w a s or d?

I have done:
function Start () {

	for(var n : int; n==0;n=0) {
		
		move.x = Input.GetAxisRaw("Horizontal");
		move.y = Input.GetAxisRaw("Vertical");
		while(move == Vector3.zero) {
			
			move.x = Input.GetAxisRaw("Horizontal");
			move.y = Input.GetAxisRaw("Vertical");
			yield;
			
		}
		
		if(move.x > 0 && !Physics.Linecast(transform.position,transform.position+Vector3(1,0,0)))
			transform.Translate(1,0,0);
		
		else if(move.x < 0 && !Physics.Linecast(transform.position,transform.position+Vector3(-1,0,0)))
			transform.Translate(-1,0,0);
		
		if(move.y > 0 && !Physics.Linecast(transform.position,transform.position+Vector3(0,1,0)))
			transform.Translate(0,1,0);
		
		else if(move.y < 0 && !Physics.Linecast(transform.position,transform.position+Vector3(0,-1,0)))
			transform.Translate(0,-1,0);
		
		yield WaitForSeconds(1f/moveSpeed);
		
	}
	
}

But I was wondering if there was another method I could do this, that doesn’t require for loops… (I have this for a 2D game using the X and Y axis)

Use the

var amMoving : boolean = false;
function Update()
{
    direction.x = Input.GetAxisRaw("Horizontal");
    direction.y = Input.GetAxisRaw("Vertical");

    if(direction != Vector3.zero && !amMoving) Move(direction);
}

function Move(direction : Vector3)
{
    amMoving = true;
    var xAxis = Vector3(direction.x, 0, 0).Normalize();
    var yAxis = Vector3(0, direction.y, 0).Normalize();

    yield StartCoroutine(LinecastAndMove(xAxis));
    yield StartCoroutine(LinecastAndMove(yAxis));

    amMoving = false;
}

function LinecastAndMove(direction : Vector3)
{
    if(direction != Vector3.zero  
       && !Physics.Linecast(transform.position,transform.position+direction))
    {
        transform.Translate(direction);
        yield WaitForSeconds(1f/moveSpeed);
    }
}

Update function is ment for things that need to execute in every frame (like checking controls for movement).

Thats basically what happens here under the hood, because you have turned your Start function into a Coroutine (which might be helpful to read about also).

I have updated the code. Here is a little generalised version of your code w/o use of ‘for’ for main game loop.