例えば、以下の例は、オーブンの電源がついているか、消えているか判定している。
オーブンが付いていた場合は、温度付きのStringを返す。
import UIKit
enum OvenState{
case on(Double)
case off
}
var ovenState = OvenState.on(450)
switch ovenState{
case let .on(temperature):
print("The oven is on and set to \(temperature) degrees")
case .off:
print("The oven is off")
}