Have a problem of setting condition

Hello everyone, I have a problem with the condition setting. Sorry for my not clear question. I want to use a few letters or short sentence as a condition in if statement. For example, in the beginning, I typing “S1” into the serial and send it from board A to board B. Then the program at board B will send a few letters back to board A. Is it possible to do that? If it is, how or what should I change in my code?
Thank you.

Board A:

#include <Wire.h>
#include <SoftwareSerial.h>

SoftwareSerial lora(7, 6); //TX, RX
String input;

void setup()
{
  Serial.begin(9600);
  lora.begin(9600);

}


void loop()
{

  //LoRa
  if (Serial.available() > 0) //Read from serial monitor and send over LoRa
  {
    input = Serial.readString();
    lora.println(input);
  }

  if (lora.available() > 1) //Read from LoRa and send to serial monitor
  {
    input = lora.readString();
    Serial.println(input);
  }
  delay(20);

  if ( Serial.readString() == "S1")
  {
    String C = "ASD";
    lora.println (C);
  }

  if (( Serial.readString() == "D1"))
  {
    String D = "QWE";
    lora.println (D);
  }
}

Board B:

#include <Wire.h>
#include <SoftwareSerial.h>

SoftwareSerial lora(2, 3); //TX, RX
String input;

void setup() {
  Serial.begin(9600);
  lora.begin(9600);
  Serial.println("LABEL, CODE, Date, Voltage"); // Condition
}

void loop()
{

  //LoRa
  {
    if (Serial.available() > 0) //Read from serial monitor and send over LoRa
    {
      input = Serial.readString();
      lora.println(input);
    }


    if (lora.available() > 1) //Read from LoRa and send to serial monitor
    {
      input = lora.readString();
      Serial.println(input);
    }
    delay(20);
  }


  if (Serial.readString() == "ASD")
  {
    String A = "ASD,OK";
    lora.println (A);
  }

  if (Serial.readString() == "QWE")
  {
    String B = "QWE,OK";
    lora.println (B);
  }
}

  if( Serial.readString() = "S1") really ??


Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

It should be pointed out that the code you posted cannot possibly compile, much less run.

In the first part "Void loop" should be "void loop", and the second part is incomplete.

Note also that "==" is used in C++ for comparisons.
"=" is for assignments.

anguswong:
But when I applied this programme, the solution didn't similar with my expectation. What have I done wrong?

Have you successfully complied this? The post above shows how you could not have complied this successfully. If you did get it compiled, what was wrong with the results that were different from your expectations? Saying this doens't meet your expectations doesn't help much, maybe because you expected it to compile and it did not?