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 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