Position in If Statement 2D

Hi guys I’m not English so please excuse my grammer. I have a Problem, maybe I’m just stupid:

When I click a button then my Object moves to the right side. Now I want that when I click the same button again, it should move to the left side. Now i wanted to do an If Statement like

if(this.transform.position.Equals(-0.81, -3.65, 0))

But then it says me that equals is overloaded or something like that.
Or when u have a completly other Code then please tell me.


If you are concerned with just left and right, you can write

    if(transform.position.x >= 0.81f)
    //Move right;
    // Move left

You cannot use Equals for Vector3 this way.
A way to equate Vector would be to use Vector3.Distance like:

    if(Vector3.Distance(transform.position, new Vector3(0.81f, -3.65f,0)) == 0)
     // Your code

But getting the exact transform position is difficult to achieve so instead of == 0, it would be a small float value like 0.2f.