Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Object-Oriented Swift 2.0 Complex Data Structures Declaring a Struct

Object oriented

let Value: (name : String, age : String) = (0,0) Value Struct User { let name: String let age: String } let User = User (x: 0, y:0)

structs.swift
// Enter your code below
let Value: (name : String, age : String) = (0,0)
Value 
Struct User {
let name: String
let age: String
}
let User = User (x: 0, y:0)

Hi Pema,

Your Struct definition is case sensitive and should be lower case, also you should double check your age constant type within the User struct.

Hope that helps you get on your way :)

1 Answer

Joshua Hawthorne
Joshua Hawthorne
18,523 Points

Hi Pema,

I'm not sure exactly what you're trying to do, but I'll show you the proper syntax below. Compare the capitalization in your code compared to mine. Remember to use camelCase when creating constants (let) and variables (var), and to capitalize structs and classes.

struct User {
    let name: String
    let age: String
}


let user = User(name: "yourName", age: 29)

let value: User = User(name: "anotherName", age: 23)