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 Scope and Loops Review Scope and Loops

2 Answers

Anjali Pasupathy
Anjali Pasupathy
28,883 Points

As you've posted nothing but the question, I'm going to assume you're having trouble getting started.

For task 1, you're asked to declare an int named mathTotal, as well as a bool named isComplete. int and bool are primitive types. Declaring a primitive type requires the following format:

TYPE NAME;

For mathTotal, that declaration would look like this:

int mathTotal;

Declaring the bool isComplete should have the same format.

I hope this helps you get started!

Simon Coates
Simon Coates
28,694 Points

The following passes

int mathTotal = 0;              //variable declaration and assignment.
bool isComplete;                //it might be better to do bool isComplete = false;

for (int i = 5; i<= 25; i++) {      //review for loops if this represents a problem.
  mathTotal += i;               //equivalent to mathTotal = mathTotal + i;  

}
isComplete=true;

There's no point in just completing the challenge. This is very introductory syntax, so you may want to clarify what it was that you were having trouble understanding.