Update function is not executing the bool

I am using following update function

bool Xpositive=false;
float XAxiscurrentXpos;
float izvalue;
Vector3 XAxisposition;
void Update()
{
       if (Xpositive == true)
    {
            while (XAxiscurrentXpos <= -izvalue)
            {
                XAxis.transform.localPosition += Vector3.right * 0.01f * Time.deltaTime;
            }
        }
        else
        {
            if (XAxiscurrentXpos > -izvalue)
            {
                while (XAxiscurrentXpos >= -izvalue)
                {
                    XAxis.transform.localPosition -= Vector3.right * 0.01f * Time.deltaTime;
                }
            }
        }} }`

Now, the Xpositive is changed in following code

 public void ObjSupport_PositionArrived(string Coordinate, double Value)
    {
        switch (Coordinate)
        {
            case "X-":
                { //X-code }
                break;
            case "X+":
                {   Xpositive = true; }
               
                break;
 
            case "Z-":
               { //code for Z  }    break;
        }
    }}

Problem is that when Bool Xpositive is set to true ,the IF in Update still is not executed.

without even knowing for sure what the problem is, I’m willing to bet it’s the while loop in your update function. Instead of using a while loop try doing this

void Update() { 
    if (Xpositive  && XAxiscurrentXpos <= -izvalue){
        // the rest of the stuff you said

while loops are pretty expensive and should really only be used if it is absolutely the only option