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

Mark McCuller
Mark McCuller
3,539 Points

Objective-C Basics quiz on operations & expressions

I am having problems in passing this quiz on question #3 to #5. I know that from question #2 (int unstable=25, variable unstable -=5) thus the answer is unstable = 20. In question #3 “Auto increment the variable named unstable:” so 20 +1 =21 but this is wrong. What is the correct answer? In Question #4 “Auto decrement the variable named unstable:” 21 -1 =20 but this is wrong. What is the correct answer? Question #5 “Use the compact form of division to divide unstable by 3” is wrong also because question #4 is wrong. I assume the answers are added and subtracted to the unstable variable to the last question. Can someone help me understand what I am doing wrong, Thank you for your help. Mark

2 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

As Michael mentioned you want to use the variable and use the ++ or -- operators to auto increment or decrement. Which would mean unstable++ or unstable--;

You're 'manually' incrementing the variable by using "20+1". You'll want to use 20++. Conversely, decrementing would be --20. Compact division would be: unstable /= 3; as opposed to 'long hand' which would be unstable = unstable/3;