Mark- If Else let number 30 if number number 30 number 20 print even n

 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
70
71
72
73
74
75
76
77
78
79
80
81
//Mark- If Else
let number = 30
if (number%2 == 0 && number == 30) || number == 20 {
print("even number")
}
else {
print("Odd Number")
}
let mark = 80
if mark >= 80 && mark <= 100 {
print("A+")
}
else if mark>=70 && mark < 80 {
print("A")
}
else if mark>=65 && mark < 70 {
print("A-")
}
else{
print("F")
}
//MARK:- Switch
let roll = 10
switch roll {
case 1:
print("Mamun")
break
case 2:
print("Talha")
break
case 3:
print("Saadi")
case 4:
print("Ferdous")
case 5, 6:
print("Masud")
case 10...100:
print("Sakib")
default:
print("No one")
}
//Mark- For Loop
for index in 0..<10 {
print(index)
}
let names = ["Talha", "Saadi", "Mamun", "Ferdous"]
for index in 0..<names.count {
print(names[index])
}
for name in names {
print(name)
}
for (index, name) in names.enumerated() {
print("Index: \(index), Name: \(name)")
}
//Mark- While Loop
var count = 0
while count < 100 {
count += 1
}
print("Count: \(count)")
// Mark- Repeat While Loop