+ 1
Can someone please explain increments and decrements to me? I only started learning coding yesterday and this is kinda confusing
Increments and Decrements in JavaScript
4 odpowiedzi
+ 3
Increment increases variable's value by "1", decrement decreases by "1".
int a = 0
a++
Value of a == 1
+ 3
@Vaibhav Jadhav
In your example in both cases the result is 11.
a=10
System.out.println(++a)
result 11
a=10
System.out.println(a++)
result 10
+ 1
increment:
i++ is the same as i=i+1;
decrement:
i-- is the same as i=i-1;
u increase or decrease your variable by 1
- 1
suppose a=10
if a++
system.out.println(a);
result=10
if ++a
system.out.println(a);
result=11