Why if statement does not work?

using UnityEngine;
using System.Collections;
public class Rotate : MonoBehaviour {

Vector3 tempPos;

void Update () {
	tempPos = transform.position;
	tempPos.x += 0.1f;
	transform.position = tempPos;

	if (tempPos > 4) {
		tempPos = transform.position;
		tempPos.x -= 0.1f;
		transform.position = tempPos;
	
	}
}

}

tempPos is a Vector3, which has 3 components (x, y, and z). It doesn’t make any sense to compare a Vector3 to an int. I assume you either mean to compare only a single component (such as tempPos.x) or that you mean to compare to the magnitude of the vector (tempPos.magnitude).