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

Kelvin Knighton
Kelvin Knighton
6,168 Points

create a String

i don't know if I'm just looking at it all wrong, I'm super new to objective c, and maybe I'm putting the syntax like the guy in the vid instructs me to do, but its not working for me, here is what i have...>>
NSString* myString= @"Crystal Ball"; thats what i had first, copying the guy in the vid, then i read the top of the page and it say>>> Create a NSString variable named 'myString' with the value 'Fun with Objective-C'. NOW HERE IS MY ANSWER TO THAT NSString* myString= @'Fun with Objective-C'. ; >> and i tried it without the ; and it still didm't work.. help please

3 Answers

Holger Liesegang
Holger Liesegang
50,595 Points

Hi Kelvin, you might want to try @"Stringtext" instead of @'Stringtext'

Tom Hill
Tom Hill
14,232 Points

Hi Kelvin, make sure you have NSString before you declare the name of the string, have a space BEFORE the * then the name of the string after the * without a space like: NSString *myString

Then a space, an equal sign (=), another space then the name of your string surrounded by DOUBLE QUOTES (") and prefixed with an @ symbol, then end it with a semicolon (;) so it looks like:

NSString *myString = @"Fun with Objective-C";

(remember to include the semi-colon)

Hope this helped - Tom

Kelvin Knighton
Kelvin Knighton
6,168 Points

thank you Holger and Tom, i will go and try it.