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
  Nila Palmo Ram
4,303 PointsCan't understand!!!
I've tried all the possible ways of solving this question, but none of then seems to be right!! can someone please tell me if is it a mistake i've did or a bug in the code challenge.
struct RGBColor {
  let red: Double
  let green: Double
  let blue: Double
  let alpha: Double
  let description: String
  // Add your code below
  init (red: Double, green: Double, blue: Double, alpha: Double) {
  self.red = red
  self.green = green
  self.blue = blue
  self.alpha = alpha
  self.description: String = ["red: \(red), green: \(green), blue: \(blue), alpha: \(alpha)"]
    }
}
var myColor = RGBColor(red: 86.0, green: 191.0, blue: 131.0, alpha: 1.0)
myColor.description
1 Answer
Magnus Hållberg
17,232 PointsThe problem is in the description string inside the init method, you have put it inside square braces like you would do with an array so delete the square braces. You have also "re specified" the type of the description constant inside the init method, that's already done when declaring it so delete that as well. The challenge never tell you to declare the myColor variable, delete that to.
  init (red: Double, green: Double, blue: Double, alpha: Double) {
    self.red = red
    self.green = green
    self.blue = blue
    self.alpha = alpha
    self.description = "red: \(red), green: \(green), blue: \(blue), alpha: \(alpha)"
  }
That should do it, hope it helps.
Nila Palmo Ram
4,303 PointsNila Palmo Ram
4,303 PointsThank you!!!