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 trialdhari alaradah
3,127 Pointshelp me to solve it please
i can not solve it help me please
struct RGBColor {
let red: Double
let green: Double
let blue: Double
let alpha: Double
let description: String
init (red: Double, green: Double, blue: Double, alpha: Double, description: String ) {
self.red = red
self.green = green
self.blue = blue
self.alpha = alpha
self.description = "red: \(self.red) gren: \(self.green) blue: \(self.blue) alpha: \(self.alpha)"
}
}
2 Answers
Kieran Black
9,139 PointsHi Dhari,
You do not need to have the description: String inside your init() as you do not want to pass this value to the struct, but have the struct calculate this itself.
Also you need commas after each value and the correct spelling of green.
struct RGBColor {
let red: Double
let green: Double
let blue: Double
let alpha: Double
let description: String
init (red: Double, green: Double, blue: Double, alpha: Double) {
self.red = red
self.green = green
self.blue = blue
self.alpha = alpha
self.description = "red: \(self.red), green: \(self.green), blue: \(self.blue), alpha: \(self.alpha)"
}
}
Hope this helps
KB
dhari alaradah
3,127 Pointsthank you
Ben Shockley
6,094 PointsSo you've got a couple of issues here.
First: you should check your spelling and punctuation on the description string, those have to match pretty much exactly for the checker to pass it.
Second: What is the purpose of taking a description parameter in the init function? You should re-evaluate that and I think you'll find your mistake.
dhari alaradah
3,127 Pointsthanks a lot
Digvijay Jaiswal
5,565 PointsDigvijay Jaiswal
5,565 PointsTry separating all the values in self.description using "," eg: "red: (self.red), green: (self.green)........)
Also please check the spelling of your green: (self.green), its actually gren not green. let me know if that works