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

Obj-C Methods: Q re blog post!

Hi all. Have a newbie question after reading this article here on Treehouse: http://blog.teamtreehouse.com/the-beginners-guide-to-objective-c-methods

Ben gives examples of how to use methods. In this example he gives us:

  1. NSString *emailAddress = @"ben@objectivecfun.com"
  2. int stringLength = [name length];
  3. // stringLength will equal 21!

And about this he says:

'The example above shows how a method is used. Here we are calling the length message on the name variable, or more accurately, sending the length message to the name object'

What I am failing to understand here is the reference to 'name' in the method call. Nowhere has name been defined, so how can he refer to a 'name' object that doesn't exist?

I am absolutely flummoxed by this. I realise there is some basic reason behind this that I don't get and I would be really grateful for help.

3 Answers

Hi Vincent,

I believe this is a typo as I read the article up-to-and-past that point and couldn't make sense of it either. /cc Ben Jakuben

Thanks Chris. Maybe he means stringLength when he refers to name variable?

10 days later no update here.