+ 1
Short answer needed
Can somebody explain to me what "++", "--", "==, means? In simple language cuz I'm rookie.. thanks
5 Answers
+ 5
++ increment
i++ --> i = i + 1
-- decrement
i-- --> i = i - 1
== boolean operator (equal)
2 == 4 --> false
2 == 2 --> true
+ 4
"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".
+ 1
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
+ 1
Thank you guys, I got it.