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 trialFred Waltman
336 PointsI guess I don't understand the question
Error message does not match the question
protocol Animal {
var numberOfLegs: Int { get }
}
protocol Pet : Animal {
var cuddlyName : String { get }
}
1 Answer
David Papandrew
8,386 PointsYou have extra leading spaces before the colons in your code.
Remove those and you should be fine.
Here's is what I mean (this code will pass):
protocol Animal {
var numberOfLegs: Int { get }
}
protocol Pet: Animal { //Removed space after Pet and colon
var cuddlyName: String { get } //Removed space after cuddlyName and colon
}
Fred Waltman
336 PointsFred Waltman
336 PointsThanks.
The error message I was getting was
"Make sure you are adding the method requirement as specified in the question to the Pet protocol"
Not very helpful. The preview showed no errors.
Any why is the space a problem? Not a problem in the Swift syntax, I tend to leave a space before and after (It's a habit from a previous environment) and never had a problem with Xcode.
I find it frustrating that there isn't an option to just give up and go on. I gave up on Treehouse a couple years ago or so ago because of that reason and I guess is a pet peeve of mine.
David Papandrew
8,386 PointsDavid Papandrew
8,386 PointsHi Fred,
All I know is that the Treehouse challenges are pretty strict about uppercase/lowercase, spaces and the like. Not something I can control so I can understand the frustration. Just something that I try to look for when I find my code not passing.
Good luck.