can't conpare two strings

Hi, i wrote this code

String act;
void setup(){
Serial.begin(9600);
Serial.println("conected");
}
void loop(){
if (Serial.available()>0)
{
act = Serial.readString();
if (act == "on")
{
Serial.println("==, on");
}
if (act.equals("on"))
{
 Serial.println("equal, on");
}
}
}

the problem is, that even if i send in the monitor on it's not recognize it.
Is someone know what the problem?
i use pro mini, if it's importent.

Your code is incomplete.

if (act == "on"") Oops

TheMemberFormerlyKnownAsAWOL:
Your code is incomplete.

if (act == "on"") Oops

you are right, but the mistake is in what i type here, in the sorce it’s ok and the code compile.

Ok, when you’ve got a relevant question, and the code to go with it (not pictures), get back to us.

TheMemberFormerlyKnownAsAWOL:
Ok, when you've got a relevant question, and the code to go with it (not pictures), get back to us.

All the code write in my first mesage, i atached picture to show that the mistake is was here, and not in my orginal code, and i have problem, . i wrote it in my first massege, mabey it's not cleraly, its because my english not very well.

The code in the first post doesn’t compile for a number of reasons, the most obvious of which is that it is incomplete.

Change the "Line Ending Feed" of the Serial Monitor to "None"

TheMemberFormerlyKnownAsAWOL:
The code in the first post doesn’t compile for a number of reasons, the most obvious of which is that it is incomplete.

you right, because the tiredness (the time in my city is 1:19 at night…) i forgot two ‘}’.

arduino_new:
Change the "Line Ending Feed" of the Serial Monitor to "None"

it's working :slight_smile: thank to both of you.

now i need to see why it's not work with the max485... but i think this will be only tomrrow...