loop incrementing but not printing increments

This program prints at it’s bound but not between:

int val, hi, lo, med;
int x = 0;

void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
val = 0;
lo = 1000;
hi = 0;
}

void loop() {
// put your main code here, to run repeatedly:
delay(2000);
x++;
val = analogRead(3);
Serial.print(x,DEC);
Serial.print(" val = “);
Serial.print(val,DEC);
Serial.print(”\n");
if(val > hi)
{
hi = val;
}
if(val < lo)
{
lo = val;
}
Serial.print(val,DEC);
Serial.print("\n");
Serial.print(x,DEC);
Serial.print(" “);
if(x = 20)
{
Serial.print(x,DEC);
med = int((lo + hi)/2);
Serial.print(”\n\nLOW: “);
Serial.print(lo, DEC);
Serial.print(”, HIGH: “);
Serial.print(hi, DEC);
Serial.print(”, MEDIAN: “);
Serial.print(med,DEC);
Serial.print(”\n\n");
x = 0;
lo = 1000;
hi = 0;
}
}

It’s output comes like this:

LOW: 58, HIGH: 58, MEDIAN: 58

1 val = 56
56
1 20

LOW: 56, HIGH: 56, MEDIAN: 56

1 val = 53
53
1 20

LOW: 53, HIGH: 53, MEDIAN: 53

1 val = 71
71
1 20

I am baffled.

  if(x = 20)

This sets x to 20. Perhaps you meant to use the == operator?

Next time, use [ code ] tags.

I cant believe I overlooked that. Thanks.