Something simply I'm sure

If i put in this code my serial monitor reads the sensor correctly. 1024 when its clear, 0 when its blocked.

int led = 13;

void setup() {                
  pinMode(led, OUTPUT);
  Serial.begin(9600);  
}
void loop() {
  int triggerValue = analogRead(A2);
  Serial.println(triggerValue);
 delay(1); 
            }

But when i add in an IF/ELSE it stops reading it correctly and only sends out 0's
What am I missing here?

int led = 13;

void setup() {                
  pinMode(led, OUTPUT);
  Serial.begin(9600);  
}
void loop() {
  int triggerValue = analogRead(A2);
    if (triggerValue = 0)
  {
    digitalWrite(led, HIGH);
  }
  else
  {
  digitalWrite(led, LOW);
  }
  Serial.println(triggerValue);
 delay(1); 
            }

Thank you thank you thank you!

What am I missing here?

The use of two equals signs in an if statement perhaps.

Thank you as always MIke, That worked. I'm looking on google for more information on why 2 ='s are needed. I really need to understand more then have it fixed I guess. But now that I know what the problem is I know what to read about.

You should make a paypal tip jar in your sig LOL.
Thanks.

why 2 ='s are needed

Because that is the way the writers of the C language wanted it. It distinguishes between one = meaning an assignment
Make one thing equal to this other thing.

And two equals == a comparison
Is this thing equal to that thing.

Other languages use other things. For example Fortran used .EQ. for a comparison.

That makes complete since. Very good basic explanation.