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

iOS

Tucker Sowers
Tucker Sowers
4,539 Points

Hi all. I am practicing with enums and passing arguments through them.

Why can't I print the string "attached to the enum Description? Is there a better way to do this? Thanks for your help!

enum ColorsInRainbow { case red case orange case yellow case green case blue case indigo case violet }

enum Description: String { case light = "These are lighter colors" case middle = "This is in the middle of the color spectrum" case dark = "This is a darker color" }

func whatDoYouThinkAboutMyColor(color: ColorsInRainbow) -> Description { switch color { case .red, .orange, .yellow: return .light case .green: return .middle case .blue, .indigo, .violet: return .dark } }

whatDoYouThinkAboutMyColor(color: ColorsInRainbow.red) whatDoYouThinkAboutMyColor(color: ColorsInRainbow.blue) whatDoYouThinkAboutMyColor(color: .green)