Variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Variables

Please can someone explain increments to me very well.. For example Var a=0, b=10; Var a=b++ Output a=10, b=11 Please how does that give that?

12th Sep 2017, 12:29 PM
Racheal Inyang Emmanuela
6 Answers
- 2
What is answer
12th Sep 2017, 4:17 PM
Shubhashree Dhikale
Shubhashree Dhikale - avatar
+ 5
var a=0 var b=10 var a=b++// it shows that the value b++ is assign to a b++ is post increment so first value is assign then it will incremented so a=10 // because b++ value is still 10 due to post increment and now the value of b incremented by 1 so b=11 so finally the output is a=10 b=11
12th Sep 2017, 12:34 PM
MsJ
MsJ - avatar
+ 2
Var a = 0; Var b = 10; a = b++ at first a = b = 10 ++ means +1, so 10+1=11 a=11, b=10
20th Mar 2020, 5:20 PM
Ella
Ella - avatar
+ 1
first of all we have variables a =0 and b=10. and in second line we are assigning the value of b to a and use ++ ie increment operator so that at last we have output a=10, b =11
13th Sep 2017, 2:12 PM
Vikas
0
Answer is a=10, b=11
12th Sep 2017, 11:50 PM
Racheal Inyang Emmanuela
0
How do i programme input using console.log in java.
3rd Apr 2021, 9:42 PM
John Mo Sh