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 Objective-C Basics Basic Data Types and Variables Numerical Variables

Usen Ekpek
Usen Ekpek
1,634 Points

create an int variable called "size" with a value of 13.

create an int variable called "size" with a value of 13.

var size: Int = 13

Anjali Pasupathy
Anjali Pasupathy
28,883 Points

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

Oh, my bad. I was in the wrong section. Sorry!

Anjali Pasupathy
Anjali Pasupathy
28,883 Points

No worries! It's always interesting to see Swift and Objective-C syntax compared side-by-side.

Usen Ekpek
Usen Ekpek
1,634 Points

Thank you Anjali.

And no problem Bill.

Thanks! :)