var dictionary = [Int:String]()
// [0: "zero", 1: "one"]
var dictionary = [Int:String]()
dictionary[0] = "zero"
dictionary[1] = "one"
dictionary = [:]
struct BookInfo {
var id = 0
var name = ""
var author = ""
var type = ""
}
var book = BookInfo(id: 10010, name: "swift", author: "apple", type: "education")
enum CompassPoint {
case north
case south
case east
case west
}
enum HttpStatusCode : Int {
case HttpFail = 0
case HttpNormal = 200
case HttpSuccess = 202
}
print(CompassPoint.east)
print(HttpStatusCode.HttpNormal)
网友评论