//Dictionary is a key value pair. It is in unorder
var score:Dictionary = ["Rahul":70, "Dhoni":183, "Kholi":140]
//another way var score[String,Int] = ["Rahul":70, "Dhoni":183, "Kholi":140]
print(score.count)
print(score["Rahul"])
//update Value
score.updateValue(100, forKey: "Dhoni")
//remove Value
score.removeValue(forKey: "Rahul")
print(score.isEmpty)
//insert value
score["Ishant"] = 2
print(score)
var score:Dictionary = ["Rahul":70, "Dhoni":183, "Kholi":140]
//another way var score[String,Int] = ["Rahul":70, "Dhoni":183, "Kholi":140]
print(score.count)
print(score["Rahul"])
//update Value
score.updateValue(100, forKey: "Dhoni")
//remove Value
score.removeValue(forKey: "Rahul")
print(score.isEmpty)
//insert value
score["Ishant"] = 2
print(score)
Sign up here with your email
ConversionConversion EmoticonEmoticon