These are basic syntax errors.
I have voted to close this question as I believe it is an unnecessary question. Since it already has one answer, will provide this as to why.
The same errors will be produced by code completely void of any blender API reference,
if x = 3
x = 4
and whether in blenders python console, or a python shell or any other python console, you can crunch it in and receive feedback on the errors, as well as variable values etc.
Here is the output of if statement in py console. The writing in red indicates an error. If you are using the text editor, the error statement will be written in the error pop-up on run, and to the system console.
At this point, rather than writing a question:
Copy the error type and paste into google, or another search engine of your choosing
Similarly the first match for python if statement syntax error
After checking out some answers you still don't understand, then write a question. Post the error messages and other details.