Is it mandatory to double the equal sign after a variable name ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it mandatory to double the equal sign after a variable name ?

26th Jul 2018, 12:36 PM
Kwadwo Opoku Agyeman
Kwadwo Opoku Agyeman - avatar
4 Answers
+ 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 😊😊
26th Jul 2018, 12:54 PM
Mohammad Amir Aqeel
Mohammad Amir Aqeel - avatar
+ 1
Mohammad Amir Aqeel Sure thing. Thanks😁
26th Jul 2018, 12:57 PM
Kwadwo Opoku Agyeman
Kwadwo Opoku Agyeman - avatar
+ 1
A single equal sign is for assigning a value to a variable while the double equal sign is for comparing arguments.
26th Jul 2018, 1:17 PM
Adelola
Adelola - avatar
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.
26th Jul 2018, 12:54 PM
Janning⭐
Janning⭐ - avatar