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

john tyler
john tyler
933 Points

what are types again?

what are types in the Swift programming language

1 Answer

Eric M
Eric M
11,545 Points

Hi John,

Types are different data structures and associated methods that represent various things. Variables have a type, this determines how the program can interact with that variable.

Most programming languages have builtin or 'primative' data types of integers, floats, booleans, and characters. You'll also generally get some builtin collections like arrays or even hashtables in modern langauges. Though this is not standard langauge by language - especially in the case of characters and strings (it turns out strings get difficult when multiple (human) languages are involved). As an example, the original C language did not have booleans - it was perhaps considered unnecessary as we already have 1 and 0 in the integer type. Some langauges will also have a NULL type or some way of dealing with the concept of nothing.

If you're asking this question I think it's probably worth going through the second part of Swift Basics even if you've done it before.

You could also consider reading the official Swift documentation on Types.

Good luck,

Eric