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

Chirag Swamy
Chirag Swamy
9,949 Points

My answer to the code challenge is correct but i'm still getting below errors in my xcode

Struct Book{ let title: String let author: String let price: Double }

let myBook = Book(title: "Animal Farm" , author: "George Orwell" , price: 6.00)

my code gives below error while running in xcode, please help whats wrong?

consecutive statements on a line ; use of unresolved identifier 'Book'

1 Answer

Sarah Hurtgen
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Sarah Hurtgen
Treehouse Project Reviewer

Hi!

You're definitely on the right path, it just needs a little tweaking! For the unresolved identifier error, it can't identify "Book" is because you have the word "struct" starting with a capital "S". When creating a struct, the name of your struct should be capitalized, but the keyword "struct" beforehand should remain lowercase.

The next problem you're encountering has to do with having all of your Book variables on the same line. This could be solved a couple ways. You could either expand each to be on its own line, or add the ";" separator between them.

For example, your code could look something like this:

struct Example {
    let firstExample: String
    let secondExample: String
}

let myExample = Example(firstExample: "Coding is fun!", secondExample: "Good luck!")

or if you prefer to keep your variables on the same line, you could structure it like this:

struct Example { let firstExample: String; let secondExample: String }

let myExample = Example(firstExample: "Coding is fun!", secondExample: "Good luck!")

Hope that helps!