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

Don't understand Code Challenge on class interface

hi I just wrote on the code:

[myString length]; [myString uppercaseString];

but the answer said I did some syntax error. I don't understand why, I just followed one by one step guided by Mr Amit. actually what the question actually want, how can I state the length of the created string?

thanks,

3 Answers

Hello!

In the video, "myString" was used as an example. Basically, myString is the name of the NSString class.

However, in the code challenge, the name of the class was aString. It was seen declared as NSString *aString = @"Objective-C is fun";

So, in order to get the length of the string. We call the method, "length". Instead of calling "[myString length]", we call "[aString length]", without the quotes.

Hope I helped!

Hi Derrick it works! I learn a valuable lesson from you. Thanks a lot pal! :)

Worked for me too. Thanks alot Derrick!