if function is not working

hey guys for one of my project i use rc522 i can read the data from card but when i try to use if function for controlling the data it fails

#include <SPI.h>
#include <MFRC522.h>
int val[3];
int as1;
int as2;
int as3;
int as4;
String uid;
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance.
byte cardPresent;

void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  SPI.begin();      // Init SPI bus
  mfrc522.PCD_Init(); // Init MFRC522 card
// Serial.println("Ready!");
}

void loop() {
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
  return;
}
//Serial.print("Card UID:");
        for (byte i = 0; i < mfrc522.uid.size; i++) {
                
                val[i] = (mfrc522.uid.uidByte[i]);
        } 
        String as1 = String(val[0]);
        String as2 = String(val[1]);
        String as3 = String(val[2]);
        String as4 = String(val[3]);
        Serial.println();
        uid = as1 + as2 + as3 + as4;
        Serial.println(uid);
        if (String(uid) = "18204122133"){
          Serial.println("Acces");
        }
        delay(50);
}

in this code if the card data is 18204122133 it has to say acces and it does but when i make it read another card it still says acces what can i do please help thanks

if (String(uid) = "18204122133")
Or
if (String(uid) == "18204122133")

The second option worked thanks but why what is the diffrence

= is assign.
== is comparison.

https://www.arduino.cc/en/Reference/Assignment

The second option worked thanks but why what is the diffrence

The second (a comparison) makes sense, but the first (an assignment) doesn't.

Thanks guys

A little bit more to what others have said "=" is an assignment operator AND it is always TRUE (the always true part often confuses people)

gpsmikey:
A little bit more to what others have said "=" is an assignment operator AND it is always TRUE (the always true part often confuses people)

It does not always return true. It returns the value of the right side of the expression. If that happens to be zero, it will return false.

Oooops - correct. My bad!

aarg:
It does not always return true. It returns the value of the right side of the expression. If that happens to be zero, it will return false.

Oooops - correct. My bad!