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 trialUsen Ekpek
1,634 Pointscreate an int variable called "size" with a value of 13.
create an int variable called "size" with a value of 13.
Anjali Pasupathy
28,883 PointsBill, you're thinking like a Swift programmer. This is Objective-C. To create a variable with a primitive type and assign a value to that variable, you just need to use the following syntax:
TYPE NAME = VALUE;
In this particular case, TYPE is int, NAME is size, and VALUE is 13.
3 Answers
Bill Merickel
11,420 PointsOh, my bad. I was in the wrong section. Sorry!
Anjali Pasupathy
28,883 PointsNo worries! It's always interesting to see Swift and Objective-C syntax compared side-by-side.
Usen Ekpek
1,634 PointsThank you Anjali.
And no problem Bill.
Anjali Pasupathy
28,883 PointsYou're welcome!
Bill Merickel
11,420 PointsThanks! :)
Bill Merickel
11,420 PointsBill Merickel
11,420 Pointsvar size: Int = 13