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! While you're at it, check out some resources Treehouse students have shared here.

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

iOS

Objective-C Basics quiz/ operations & expressions HELP!

Hi I'm continually getting the question 3: Auto increment the variable named unstable:

int unstable = 25; unstable -= 5 which i believe to be 5

and question 4: Auto decrement the variable named unstable:

int unstable = 25; unstable -= 5; unstable++; plz help thx

3 Answers

Auto-increment refers to the ++ operator, auto-decrement refers to the -- operator.

Hence, to auto-increment a variable somevariable, you would do somevariable++; This is equivalent to incrementing by 1, i.e. somevariable+=1

Similarly, to auto-decrement somevariable, you would do somevariable--; This is equivalent to decrementing by 1, i.e. somevariable-=1

For these questions, just append your code after what's already there.

THANKS SO MUCH!!!!!!!!!!!!!!!!!!!!!!!

The question is missing a semicolon following the second line of code. Since on the iPad the question is all presented inline, if somebody wants to enter it before the auto increment the answer will be counted as incorrect.

Here is how it appears on the iPad Treehouse app:

Auto increment the variable named unstable: int unstable = 25; unstable -= 5 _____