Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Egor Bedunkevich
605 PointsI do not get the postfix ++ unary operator
Why does this give me 0 in the result pane, but when I type it again, it gives me 1. Take a look!
var scoreExample = 0 scoreExample++ scoreExample //when I type it again, it is 1... why?
2 Answers

Jhoan Arango
14,575 PointsEgor :
The operator ++ increments values one by one. Here is an example
var someScore = 0 // someScore is now 0
// if I want to increment “someScore” by ONE, I can do it like this
someScore++ // this will equal now to 1
// if I do it again
someScore++ // this will equal 2 now.
// Say that I now want to bring the “someScore” back to 0
someScore = 0 // this will RESET the someScore back to 0
The ++ operator increments a value by one, the -- operator decrements a value by one.
Hope that clears it

Caleb Kleveter
Treehouse Moderator 37,862 PointsIs that all your code? Is there a printf statement?