2D moving Platform

#pragma strict
private var Xpos : float;
private var Ypos : float;
private var max : boolean;
var Vert : boolean;
var maxAmount : int;
var step : float;
function Start () {
Xpos = transform.position.x;
Ypos = transform.position.y;
}
function Update () {
//SET THE MAX
if(Vert){ //Vertical
if(transform.position.y >= Ypos + maxAmount){
max = true;
} else if(transform.position.y = Xpos + maxAmount){
max = true;
} else if(transform.position.x <= Xpos){
max = false;
}
}
//MOVING THE PLATFORM
if(Vert){ // Vertical movement
if(!max){
transform.position.y += step;
} else {
transform.position.y -= step;
}
} else { //Horizontal movement
if(!max){
transform.position.x += step;
} else {
transform.position.x -= step;
}
}
}

//Whats wrong please help me these are my errors

//Assets/Scripts/MovingPlatform.js(17,32): BCE0044: expecting ), found ‘=’.

//Assets/Scripts/MovingPlatform.js(17,50): BCE0043: Unexpected token: ).

//Assets/Scripts/MovingPlatform.js(19,3): BCE0044: expecting }, found ‘else’.

//Assets/Scripts/MovingPlatform.js(37,1): BCE0044: expecting EOF, found ‘}’.

your script should be like this :

#pragma strict

private var Xpos : float;
private var Ypos : float;
private var max : boolean;
var Vert : boolean;
var maxAmount : int;
var step : float;
function Start () {
	Xpos = transform.position.x;
	Ypos = transform.position.y;
}
function Update () {
	//SET THE MAX
	if(Vert){ //Vertical
		if(transform.position.y >= Ypos + maxAmount){
			max = true;
		}else if(transform.position.y == Xpos + maxAmount){
			max = true;
		} else if(transform.position.x <= Xpos){
			max = false;
		}
	}
	//MOVING THE PLATFORM
	if(Vert){ // Vertical movement
		if(!max){
			transform.position.y += step;
			transform.position.x += step;
		} else {
			transform.position.y -= step;
			transform.position.x -= step;
		} 
	}
}

but I think it is better to do that :

#pragma strict

private var Xpos : float;
private var Ypos : float;
var max : boolean;
var Vert : boolean;
var Horiz : boolean;
var maxAmountY : int;
var maxAmountX : int;
var step : float;

function Start () {
	Xpos = transform.position.x;
	Ypos = transform.position.y;
}
function Update () {
	//SET THE MAX
	if(Vert){ //Vertical
		if(transform.position.y >= Ypos + maxAmountY){
			max = true;
		} else if(transform.position.y <= Ypos){
			max = false;
		}
	}
	
	if(Horiz){//Horizontal
		if(transform.position.x >= Xpos + maxAmountX){
			max = true;
		} else if(transform.position.x <= Xpos){
			max = false;
		}
	}
	
	//MOVING THE PLATFORM
	if(Vert){ // Vertical movement
		if(!max){
			transform.position.y += step;
		} else {
			transform.position.y -= step;
		} 
	}
	
	if(Horiz){ //Horizontal movement
		if(!max){
			transform.position.x += step;
		} else {
			transform.position.x -= step;
		} 
	}
}