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.

Welby Obeng
20,340 PointsI don't understand this task
Pasan Premaratne I don't understand this task
You said to create a failable initializer that accepts a dictionary as input an initializes all the stored properties. How can I do that if all the properties are constants? Am I missing something
struct Book {
let title: String
let author: String
let price: String?
let pubDate: String?
}
4 Answers

Michael Hulet
47,842 PointsA constant's value doesn't change once it's initialized. In other words, it's legal to do something like this:
class Example{
let constant: String
init(value: String){
self.constant = value
}
}

TeamTreeHouse ✔
1,128 PointsCreate a constant named favDessert and assign to it a string containing your favorite dessert. Remember the syntax for a string is some text enclosed with two double quotes. Pro Tip: Dessert is spelled with two s'

Jason Hess
4,789 Pointsso I'm new to swift and trying to pass this challenge, here's my code:
let = "favDessert";
var str = "cookies";
Do I ned to include the semi-colons?
I've also tried this syntax, what am I doing wrong here.
let str = "favDessert"
let str = "cookies"
Any help would be great. Thanks in advance

ios1alamin
4,310 PointsHere is the correct answer: let favDessert = "Candy" (Note: You can use anything instead of "Candy")

stephenallison
8,559 Pointslet favoriteDessert = "input fav here" is the proper syntax. The question itself can be tricky.