[ios] swift 체험하기 #9 딕셔너리
메뉴 일곱2019. 4. 15. 07:39
반응형
import UIKit
var str = "Hello, playground"
var arrStr = ["one", "two"]
//array - ordering
var dicStr = Dictionary<String, String>()
dicStr["one"] = "first"
dicStr["two"] = "second"
dicStr["three"] = "third"
print(dicStr)
//like this '["one": "first", "two": "second", "three": "third"]'? yes or no
//dictionary - no ordering
var dicStr2 = [String:String]()
dicStr2["one"] = "first"
dicStr2["two"] = "second"
dicStr2["three"] = "third"
print(dicStr2)
dicStr["one"] = nil
print(dicStr)
dicStr2.removeAll()
print(dicStr2)
'메뉴 일곱' 카테고리의 다른 글
[ios] swift 체험하기 #10 웹뷰 (0) | 2019.04.16 |
---|---|
[ios] swift 체험하기 #8 배열 (0) | 2019.04.12 |
[ios] swift 체험하기 #7 프로퍼티 (0) | 2019.04.11 |