Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Object-Oriented Objective-C Memory, Arrays and Loops, Oh My! Immersive Example - Gabe's KFC

Daniel Kokin
Daniel Kokin
1,496 Points

Are quotation marks and parentheses interchangeable in an array?

In all of the lessons we've seen quotation marks surrounding the each element, yet the KFC problem used data with parentheses.

I tried using parentheses in the historyClass example and xcode says "use of undeclared identifier 'chris' (in addition to the other names in the array).

    NSMutableArray *seatingArray = [[NSMutableArray alloc] initWithObjects:  @(Page), @(Chris), @(Earnest), @(Mike), @(John), nil];

1 Answer

In the previous examples the array items were NSStrings he used the string literal syntax @"SomeString". Here he is using enum values, which are not strings, but names for constant integral values. The syntax @(SomeEnum) syntax converts the enum into integral form and stores it in the array. Here is a link I found: http://clang.llvm.org/docs/ObjectiveCLiterals.html