Day-4【SwiftUI的100天】

2023-10-22  本文已影响0人  哈哈11122

如何使用类型注释

var name: String = "John"
var score: Double = 0

var albums: [String] = ["Red", "Fearless"]
var user: [String: String] = ["id": "@twostraws"]
var books: Set<String> = Set(["The Bluest Eye", "Foundation", "Girl, Woman, Other"])
//赋予空值
var cities: [String] = []
var clues = [String]()

下面初始化是否合法?

let username: String
// lots of complex logic
username = "@twostraws"
// lots more complex logic
print(username)
上一篇下一篇

猜你喜欢

热点阅读