MARK Array let names String Talha Mamun Saadi var numbers Int Int let

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//MARK:- Array
let names: [String] = ["Talha", "Mamun", "Saadi"]
var numbers: [Int] = [Int]()
let score = [Int]()
let results = [79, 65, 54]
numbers.append(10)
numbers.append(20)
numbers += [30, 40, 50]
numbers.insert(70, at: 3)
numbers.remove(at: 2)
numbers
print(numbers)
print("The array of numbers is \(numbers)")
print("The array of numbers is ", numbers)
numbers.count
numbers.first
numbers.firstIndex(of: 70)
numbers.removeAll()
if numbers.isEmpty {
print("Array is Empty")
}
else {
print("Numbers: \(numbers)")
}
// MARK:- Set
var persons: Set<String> = ["Talha", "Mamun", "Talha"]
persons.insert("Saadi")
persons.remove("Talha")
// MARK:- Dictionary
var student = [
10: "Talha",
23: "Mamun",
34: "Saadi"
]
print(student)
student[14] = "Ferdous"
student[9] = "Masud"
print(student)
print(student[10])
print(student[12])
if let name = student[10] {
print(name)
}
student[23] = nil
print(student)
var players: [String: [Int]] = [:]
players["Shakib"] = [10, 20]
print(players)