列挙型




// 列挙型
enum Direction {
    case up
    case down
}

var dir: Direction
dir = .up

switch (dir) {
case .up:
    print("up")
case .down:
    print("down")
}

enum Direction1: Int {
    case up = 1
    case down  = -1
}

print(Direction1.down.rawValue) //----- -1