+ 1

What is wrong with : if x = 0

I get invalid syntax

4th Jan 2022, 12:23 PM
Anestis
Anestis - avatar
3 Answers
+ 5
If you meant to verify whether <x> was zero or not, usually a == is used, a = on the other hand is commonly used to assign something as value of a variable etc.
4th Jan 2022, 12:28 PM
Ipang
+ 4
In which language?? And code link!! in py, if x == 0 : print("zero") == comparison operator = assignment operator which one you are trying to use?
4th Jan 2022, 12:26 PM
Jayakrishna 🇼🇳
+ 1
Thank you
4th Jan 2022, 12:28 PM
Anestis
Anestis - avatar