+ 1
Is it mandatory to double the equal sign after a variable name ?
4 Réponses
+ 10
Bryan Opoku Agyeman == means equality it checks whether values are equal or not where as = is an assigning operator so in an if statement
if(i==0)
it checks whether i is equal to 0 or not
if you write if(i=0) then you will get an error as i=0 is an assigning statement rather than checking one
Hope you understood 😊😊
+ 1
Mohammad Amir Aqeel Sure thing. Thanks😁
+ 1
A single equal sign is for assigning a value to a variable while the double equal sign is for comparing arguments.
0
Single equal sign and double equals sign are used for two different things:
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_operators.asp
If I guessed the language wrong, please specify in your question.