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 Swift 2.0 Collections and Control Flow Control Flow With Conditional Statements Recap: Control Flow with Conditional Statements

Need clarification

Not sure why this statement means status !is "Common". I don't know what string "status" equals

1 Answer

Jake Adams
Jake Adams
1,608 Points

It wants you to walk through the if statements and figure out which comparison will be true based on the values of isAvailable and isCheap

var isAvailable = true
var isCheap = true

var status: String

if !isCheap && !isAvailable {
    status = "super rare"
} else if isCheap && isAvailable {
    status = "not rare"
} else if !isCheap && isAvailable {
    status = "somewhat rare"
} else {
    status = "common"
}

In this case, both are true, so status will get set to "not rare"