Can somebody explain to me what "++", "--", "==, means? In simple language cuz I'm rookie.. thanks
5/17/2019 10:16:30 PM
Miralem Asceric5 Answers
New Answer++ increment i++ --> i = i + 1 -- decrement i-- --> i = i - 1 == boolean operator (equal) 2 == 4 --> false 2 == 2 --> true
"i++" - post-increment, "i--" - post-decrement: "returns the original value before changing the variable." "++i" - pre-increment, "--i" - pre-decrement: "first changes the variable, and then returns the value".
i=5; i++; print(i); //prints 6; i=5; i--; print(i); //prints 4; == is for comparing variables. for example: a=5; if (a==5) print("Hello"); //prints Hello
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message