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!
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

Dustin Bryce Flanary
17,663 Points"Expected declaration" error, empty last line of file
I am getting a "expected declaration" error on the last (empty) line of my InteractiveStory.swift file.
Here's the github link, I couldn't figure out how to post the code from the file with the error appearing as well.
1 Answer

Martin Wildfeuer
Courses Plus Student 11,071 PointsFirstly, your struct Adventure
misses a closing }
, which confuses the compiler.
Secondly, you will have to move the return statement in your addChoice
method outside the switch statement as below.
func addChoice(title: String, page: Page) -> Page {
switch (firstChoice, secondChoice) {
case (.Some, .Some):
break
case (.None, .None), (.None, .Some):
firstChoice = (title, page)
case (.Some, .None):
secondChoice = (title, page)
}
return page
}
Please note that I have not checked whether that makes sense, it should remove the compiler warnings, though.
Hope that helps :)