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 Object-Oriented Swift 2.0 Complex Data Structures Declaring a Struct

yusuf Dibswazit
yusuf Dibswazit
1,522 Points

why are these questions so complicated in explaining what it is for me to do, what haven't i done properly ?

what is asked is that i give TWO constant stored, when i name them anything, i.e max, Tom, it tell's me to make sure that I'm assigning them to a constant called NAME?

structs.swift
// Enter your code below
struct User {
let name: age
let name: age
}
Jose Patarroyo
Jose Patarroyo
2,953 Points

hello yusuf.

The challenge asks you to create tow constants. One should be named "name" and the second one should be name "age". You created to constants both of them with the same name. Furthermore, the name constant should by of the type String "name: String" while the age constant should be of the type Int "age: Int"; the constant you created are of the type "age" which doesn't exist. If you try to run your code in Xcode you should get an error.

Hope this helped you

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Jose is correct! (Again, I might add.) I feel like you're probably misreading the instructions. It does specifically say two constants one named "name" and one named "age" of different types. It never says to assign any values to the constants. Below you'll find the code for what it should look like.

// Enter your code below
struct User {
  let name:String
  let age:Int
}