What output will be produced by the code below?

enum Weather {
    case sunny
    case cloudy
    case windy(speed: Int)

let today: Weather = .windy(speed: 10)

switch today {
case .sunny, .cloudy:
    print("It's not that windy")
case .windy(let speed) where speed >= 10:
    print("It's very windy")
    print("It's a bit windy")


Correct answer: "It's very windy".

Explanation: The windy case value has an associated value to store the wind speed as an integer. In the code, this is set to 10, which means the "It's very windy" case will be triggered in the switch block.



© 2017