+ 3

What is the difference between i=1 and i==1 and What does i+=1 means

You guys just give me what you have on your mind if you don't mind and if I am not taking your Golden Time.

1st Sep 2020, 6:57 PM
Henok
Henok - avatar
3 Respostas
+ 4
i=1 assigns 1 to variable i. i==1 compares i with 1. It doesn't mutate/change the value of i. It just evaluates true or false depending on whether i is equal to 1. i+=1 adds 1 to the old value of i.
1st Sep 2020, 7:01 PM
Josh Greig
Josh Greig - avatar
+ 2
First = is Assignment operator. Second == Comparison operator Third += increment operator.
1st Sep 2020, 7:24 PM
shubham kumar
shubham kumar - avatar
+ 1
Tnx
1st Sep 2020, 7:30 PM
Henok
Henok - avatar