1
00:00:01,200 --> 00:00:02,090
Hey everybody.

2
00:00:02,100 --> 00:00:04,170
Welcome back to the coding Party.

3
00:00:04,190 --> 00:00:06,680
Mark Price here at death's slopes dot com.

4
00:00:06,720 --> 00:00:14,340
And today we're going to talk about dictionaries and what I'd like you to do before we start is actually

5
00:00:14,340 --> 00:00:23,070
do me a favor and do a google search type in how do hash tables work in computer science how to hash

6
00:00:23,070 --> 00:00:28,470
tables work in computer science and go read some articles and start getting an idea of what a hash table

7
00:00:28,470 --> 00:00:33,510
is and then posits video and go do that and come back here like in 15 minutes because I want you to

8
00:00:33,510 --> 00:00:35,330
have a base foundation.

9
00:00:35,870 --> 00:00:36,840
Did you do that.

10
00:00:36,900 --> 00:00:39,390
I'm sure you didn't because now you listen to me.

11
00:00:39,390 --> 00:00:43,400
Until you start getting those job interviews and then they're like how does this work in you're like

12
00:00:43,650 --> 00:00:48,600
Mark you're right this whole time I should have been listening to what I just said and read about this

13
00:00:48,600 --> 00:00:49,670
and this and that and that.

14
00:00:49,680 --> 00:00:52,960
But instead I just was hoping that you had a video on it and to whole.

15
00:00:53,010 --> 00:00:54,700
But anyway I went to read it and I got the job.

16
00:00:54,820 --> 00:00:57,100
That's always happens.

17
00:00:57,100 --> 00:00:57,700
Don't listen to me.

18
00:00:57,720 --> 00:00:59,580
Listen to me whatever.

19
00:00:59,600 --> 00:01:01,160
Do whatever you want your life.

20
00:01:01,170 --> 00:01:01,630
All right.

21
00:01:01,770 --> 00:01:07,980
So I'm creating a new playground here and we're going to call this one dictionary.

22
00:01:08,420 --> 00:01:15,840
Dictionaries so in swift a hash table it's called the dictionary and in different languages the hash

23
00:01:15,840 --> 00:01:20,260
tables are hash maps or in this case dictionary here.

24
00:01:20,760 --> 00:01:24,460
And I'm going to go ahead and store this in my dictionaries folder.

25
00:01:25,160 --> 00:01:26,000
OK.

26
00:01:26,610 --> 00:01:32,010
There's our playground and I'm a pull up in this nice little info graphic that Apple has created.

27
00:01:32,070 --> 00:01:36,400
So there are three major collection types in swift.

28
00:01:36,570 --> 00:01:41,020
We have the array OK which is which is in an ordered set.

29
00:01:41,430 --> 00:01:48,960
Excuse me an ordered list of items and you can have multiple values of the same type in an array.

30
00:01:48,960 --> 00:01:55,260
So for instance index 0 can have let's say the word 6 eggs but also index 5 can have the exact same

31
00:01:55,260 --> 00:01:57,290
word six makes doesn't matter.

32
00:01:57,420 --> 00:02:00,510
OK a linear list ordered items.

33
00:02:00,510 --> 00:02:01,130
OK.

34
00:02:01,470 --> 00:02:03,130
Now we've got something called the set.

35
00:02:03,210 --> 00:02:11,490
Now a set is has items that should only have one type of value meaning the values need to be unique

36
00:02:11,700 --> 00:02:12,600
but they're not ordered.

37
00:02:12,720 --> 00:02:14,250
OK but they are unique.

38
00:02:14,790 --> 00:02:17,070
And then we've got this cool thing here called the dictionary.

39
00:02:17,070 --> 00:02:19,840
Now you're going to use dictionaries and arrays more than you are sets.

40
00:02:19,860 --> 00:02:26,250
When you're working with swift The dictionary has keys and values and we're going to have an example

41
00:02:26,250 --> 00:02:30,460
similar to this today basically where the key is of a certain type.

42
00:02:30,600 --> 00:02:35,640
And then there is a value that's related to that key so that the values can all be the values can be

43
00:02:35,940 --> 00:02:41,110
the same as the other values of the other keys but the keys must always be unique.

44
00:02:41,310 --> 00:02:41,610
OK.

45
00:02:41,610 --> 00:02:43,350
And these this is not ordered.

46
00:02:43,350 --> 00:02:44,150
OK.

47
00:02:44,220 --> 00:02:50,250
And there are actually very complex and efficient algorithms algorithms working under the hood that

48
00:02:50,430 --> 00:02:52,560
help you retrieve and fetch items.

49
00:02:52,560 --> 00:02:55,950
Imagine if you had a dictionary that had a million keys in it.

50
00:02:55,980 --> 00:02:59,350
You know it's not going to go through the entire list of keys.

51
00:02:59,360 --> 00:03:04,470
OK it's going to start breaking things down and segregating out sections until it finds the key and

52
00:03:04,470 --> 00:03:05,160
the fastest route.

53
00:03:05,160 --> 00:03:07,630
Very complex things going underneath the hood.

54
00:03:07,680 --> 00:03:12,520
Again if you do that search I told you too on how the hash tables work.

55
00:03:12,570 --> 00:03:17,370
There's some amazing YouTube videos on how this actually works underneath the hood if you're into that

56
00:03:17,370 --> 00:03:18,140
kind of thing.

57
00:03:18,300 --> 00:03:22,830
And anyway so we're going to be working with the dictionary today and we're going to work with keys

58
00:03:22,890 --> 00:03:23,670
and values.

59
00:03:23,710 --> 00:03:24,080
OK.

60
00:03:24,090 --> 00:03:28,000
So this is straight out of the Swift books with three e-book.

61
00:03:28,020 --> 00:03:30,250
Very important that you read that book.

62
00:03:30,570 --> 00:03:32,510
Of course I've said that before.

63
00:03:32,550 --> 00:03:34,470
And here we go.

64
00:03:34,560 --> 00:03:43,390
We're going to create our first dictionary names of us and I want I want you to do names of integers.

65
00:03:43,530 --> 00:03:53,010
Let's say we want a dictionary that lets us give a word a visual word that you can print out for a number

66
00:03:53,010 --> 00:03:58,680
type meaning like let's say I want the number three to say the word Three things like that.

67
00:03:58,680 --> 00:04:08,790
So what I can do is I can say names of integers equal or subscript here the square brace here and we're

68
00:04:08,790 --> 00:04:14,740
going to say three equals three.

69
00:04:14,750 --> 00:04:15,790
Now I know what you're thinking.

70
00:04:15,890 --> 00:04:17,860
Oh this is just like an array.

71
00:04:17,930 --> 00:04:19,700
This is like the third index right.

72
00:04:19,700 --> 00:04:21,280
No it is not.

73
00:04:21,290 --> 00:04:22,280
No it is not.

74
00:04:22,280 --> 00:04:26,940
This is actually the name of the key I just made the names of the keys of type int.

75
00:04:26,950 --> 00:04:32,030
OK this has nothing to do actually with an array it's not a subscript in that.

76
00:04:32,060 --> 00:04:34,220
You're grabbing an ordered amount of items.

77
00:04:34,220 --> 00:04:34,620
OK.

78
00:04:34,700 --> 00:04:39,310
This is just happened to be what I type I chose for the key.

79
00:04:39,320 --> 00:04:41,930
This could also have been a string here which is interesting.

80
00:04:41,960 --> 00:04:46,430
So this is a simple example of your very first dictionary.

81
00:04:46,430 --> 00:04:50,630
And what we're doing here is we're just creating one on the fly.

82
00:04:50,750 --> 00:04:52,640
Initializing it using type inference.

83
00:04:52,640 --> 00:04:53,100
OK.

84
00:04:53,240 --> 00:04:57,770
We're creating a dictionary with a key of type and and a value of type string.

85
00:04:57,780 --> 00:05:02,030
I would not be able to do something like this and put a 3 in here.

86
00:05:02,040 --> 00:05:02,710
OK.

87
00:05:02,720 --> 00:05:10,460
Because the value needs to be a string cannot assign value of type it to string cast of keys and values.

88
00:05:10,520 --> 00:05:16,250
All of this may look familiar to you if you've worked with the race names of integers or see one more.

89
00:05:16,520 --> 00:05:23,220
And let's say 44 equals forty four.

90
00:05:23,320 --> 00:05:23,880
OK.

91
00:05:23,960 --> 00:05:31,210
The idea behind this dictionary is there's a unique key and then there's a value a word value for that

92
00:05:31,210 --> 00:05:33,940
we're just explaining in words so simple example.

93
00:05:34,280 --> 00:05:38,490
If you want to click quickly clear out a dictionary empty all the items out of it.

94
00:05:38,600 --> 00:05:41,870
It's as easy as doing this.

95
00:05:42,560 --> 00:05:43,130
OK.

96
00:05:43,310 --> 00:05:48,680
Square braces colon square braces it's going to clean out all of your keys and all of your values.

97
00:05:49,100 --> 00:05:50,070
Nice and new.

98
00:05:50,440 --> 00:05:53,980
Let's do a more real world example let's say we have an app.

99
00:05:54,280 --> 00:05:55,020
OK.

100
00:05:55,610 --> 00:05:59,750
And let's talk about airports of the world we want to have an app has all the airports of the world

101
00:05:59,750 --> 00:06:05,000
well every airport can only have one unique airport code.

102
00:06:05,000 --> 00:06:11,060
Imagine if airports had the same airport codes it would be crazy like imagine if Ireland had an LAX

103
00:06:11,300 --> 00:06:16,900
Los Angeles had an L.A. X you know and Dubai hadn't lax it wouldn't work and it would mess things up

104
00:06:16,910 --> 00:06:22,880
so luckily we have unique airport codes that we can use throughout the world and each one has its own

105
00:06:22,880 --> 00:06:24,160
name its own unique name.

106
00:06:24,180 --> 00:06:29,180
And you know what maybe the airport codes are different and maybe two airports can have the exact same

107
00:06:29,180 --> 00:06:32,900
name but that wouldn't matter because it has its unique code and that's the most important thing.

108
00:06:32,960 --> 00:06:34,120
But we still need the name.

109
00:06:34,280 --> 00:06:38,310
So that's the advantage of using dictionaries is the Keys have to be unique.

110
00:06:38,480 --> 00:06:42,690
They have to be let's do that now to create our dictionary sort of our airports.

111
00:06:42,980 --> 00:06:48,110
And this is going to be of type string so we're going to do it in explicitly declared dictionary.

112
00:06:48,110 --> 00:06:52,310
So the key is of type string and the value is of type string.

113
00:06:52,340 --> 00:06:54,840
Now let's go ahead and initialize it here right off the bat.

114
00:06:54,890 --> 00:07:00,560
So we're going to create some dictionary literals here that we're initialising right when we declare

115
00:07:00,590 --> 00:07:01,280
as well.

116
00:07:01,490 --> 00:07:03,140
So Toronto

117
00:07:06,240 --> 00:07:06,800
can.

118
00:07:07,120 --> 00:07:14,470
So we've just created a dictionary that comes preloaded with one element in it or one key value combination.

119
00:07:14,470 --> 00:07:18,720
But we want to do more so we're going to put a comma here and L.A..

120
00:07:18,880 --> 00:07:19,560
OK.

121
00:07:19,880 --> 00:07:25,160
And what we're going to do is say loss or Los Angeles.

122
00:07:25,470 --> 00:07:26,430
OK.

123
00:07:27,340 --> 00:07:28,420
Pretty cool actually.

124
00:07:28,420 --> 00:07:33,130
Los Angeles say international.

125
00:07:33,750 --> 00:07:34,340
OK.

126
00:07:34,460 --> 00:07:36,970
So I actually did not go there.

127
00:07:36,990 --> 00:07:38,120
There we go.

128
00:07:38,640 --> 00:07:39,200
OK.

129
00:07:39,310 --> 00:07:41,320
So what is happening here.

130
00:07:41,380 --> 00:07:43,810
So we put in the key name first and then a colon.

131
00:07:43,810 --> 00:07:44,140
OK.

132
00:07:44,190 --> 00:07:48,910
The colon separates the keys and the values of the key name goes first the call and then the value the

133
00:07:48,910 --> 00:07:52,720
comma separates the elements or the combinations.

134
00:07:52,720 --> 00:07:54,670
So this is one key value combination.

135
00:07:54,670 --> 00:07:56,860
This is a second and it's separated by a comma.

136
00:07:56,860 --> 00:08:04,840
So key name colon value comma key named colon value comma key name call and value comma.

137
00:08:05,410 --> 00:08:12,460
And we didn't have to explicitly declare it like so we could have used type inference and it should

138
00:08:12,460 --> 00:08:18,770
just work out of the box for us indicating that yes this is a string key and this is a string value.

139
00:08:18,820 --> 00:08:19,450
Pretty cool.

140
00:08:19,540 --> 00:08:24,130
So now we've got our dictionary full of airports and there's some of the other things we can do with

141
00:08:24,130 --> 00:08:25,080
this.

142
00:08:25,660 --> 00:08:31,340
We can print the Air Force dictionary has.

143
00:08:31,870 --> 00:08:44,030
Let's you some string interpellation airports rockhound airport or Osei element's items.

144
00:08:44,800 --> 00:08:52,190
OK let's make this a little bigger here so you can see this area.

145
00:08:52,500 --> 00:08:54,430
Put the quotation to soon.

146
00:08:54,540 --> 00:08:56,570
So the airport's dictionary has two items.

147
00:08:56,570 --> 00:08:57,080
Is that true.

148
00:08:57,100 --> 00:09:02,410
Well yes it is one and two guys so you can get the count of a dictionary.

149
00:09:02,800 --> 00:09:04,240
And what else can we do.

150
00:09:04,650 --> 00:09:09,800
If airports is empty you can see if it's empty or not.

151
00:09:09,910 --> 00:09:17,080
To Trent the airport's dictionary is empty.

152
00:09:17,690 --> 00:09:17,960
OK.

153
00:09:18,010 --> 00:09:19,290
So you can check if it's empty.

154
00:09:19,330 --> 00:09:24,360
The simple little came in and you're probably wondering well how do I add new items to a dictionary.

155
00:09:24,400 --> 00:09:30,490
Well since we're not making an ordered array where an element goes onto the back of the list we're inserting

156
00:09:30,490 --> 00:09:32,260
at a certain place we don't care about that.

157
00:09:32,260 --> 00:09:33,940
All we care about is the unique key.

158
00:09:34,060 --> 00:09:37,630
So we can just say airports let's add a new one.

159
00:09:37,630 --> 00:09:41,360
LHR equals London.

160
00:09:42,280 --> 00:09:47,500
So what we're doing here is we're setting LHR.

161
00:09:47,500 --> 00:09:54,020
This is the key name OK we're setting that unique key key value to be of the value of the type not type

162
00:09:54,030 --> 00:09:55,630
but the value to be London.

163
00:09:55,630 --> 00:09:56,120
OK.

164
00:09:56,260 --> 00:10:00,130
So the unique key LHR is going to be equal to London.

165
00:10:00,130 --> 00:10:00,770
Okay.

166
00:10:00,820 --> 00:10:03,320
And we just added a new element at this point in time.

167
00:10:03,700 --> 00:10:09,820
Okay well what if we want to update this or overwrite it it's just as simple as doing the exact same

168
00:10:09,820 --> 00:10:10,730
thing.

169
00:10:11,260 --> 00:10:12,960
Okay.

170
00:10:16,670 --> 00:10:21,110
So what we did here was whatever was in that spot we have now overwritten it's gone.

171
00:10:21,230 --> 00:10:22,920
So that's how you replace elements.

172
00:10:22,930 --> 00:10:27,200
That's also how you update elements didn't matter if one of these key names existed before or not.

173
00:10:27,200 --> 00:10:31,570
No it does not matter because it will be created the moment you assign it there.

174
00:10:31,730 --> 00:10:32,390
OK.

175
00:10:32,390 --> 00:10:36,770
So if you're thinking well if there's nothing in there and I tried to assign something to it it's going

176
00:10:36,770 --> 00:10:37,720
to give me an air.

177
00:10:37,730 --> 00:10:38,590
That's not the case.

178
00:10:38,720 --> 00:10:42,270
Unlike in an array where if you try and grab an item that doesn't exist.

179
00:10:42,410 --> 00:10:44,130
Ok you get the crash you know.

180
00:10:44,150 --> 00:10:45,190
It's different here.

181
00:10:45,350 --> 00:10:46,380
OK.

182
00:10:47,530 --> 00:10:52,760
What else let's say airport loads up here.

183
00:10:54,520 --> 00:10:55,180
All right.

184
00:10:55,450 --> 00:10:57,810
Say airports.

185
00:10:58,320 --> 00:11:01,730
Create a new one dev equals slopes International.

186
00:11:01,750 --> 00:11:05,130
And you guys know that deps slopes has its own airport now.

187
00:11:05,590 --> 00:11:09,160
And we have Wi-Fi and roller coasters and birthday cakes.

188
00:11:09,180 --> 00:11:10,410
Really cool.

189
00:11:11,170 --> 00:11:15,640
And then we realized it was a dream and it doesn't exist so how do we actually remove an item completely

190
00:11:15,640 --> 00:11:22,180
we want to go on key and everything because there is no there Loeb's airport with cakes and Wi-Fi and

191
00:11:22,180 --> 00:11:24,130
roller coasters would be cool.

192
00:11:24,130 --> 00:11:25,640
We probably had a draft in there too.

193
00:11:25,750 --> 00:11:27,320
But my dreams are now crushed.

194
00:11:27,450 --> 00:11:31,850
So airports dev.

195
00:11:31,960 --> 00:11:32,840
Neal.

196
00:11:33,250 --> 00:11:36,290
You can set it to nil which will completely destroy and remove the item.

197
00:11:36,340 --> 00:11:38,570
It is gone.

198
00:11:39,190 --> 00:11:43,120
So I hope you're starting to see oh I can work with keys and values they're unique.

199
00:11:43,120 --> 00:11:44,530
I can do different things with them.

200
00:11:44,590 --> 00:11:45,750
You're going to use these a lot.

201
00:11:45,820 --> 00:11:47,670
Hey we're just scratching the surface here.

202
00:11:47,680 --> 00:11:53,500
You can also iterate through through an a dictionary which is cool as well.

203
00:11:53,530 --> 00:11:56,320
You can get all the keys and values out of it which we'll do right now.

204
00:11:56,400 --> 00:12:08,120
So House today here for each airport code an airport name in airports.

205
00:12:08,300 --> 00:12:08,500
OK.

206
00:12:08,510 --> 00:12:10,870
So what we're doing here is a four inch loop.

207
00:12:10,880 --> 00:12:11,510
OK.

208
00:12:11,750 --> 00:12:16,550
And the for loop in this case in the dictionary it's giving us what's called a tuple.

209
00:12:16,820 --> 00:12:24,830
OK a tuple is a data type or a data construct that has one or more elements in it.

210
00:12:24,980 --> 00:12:28,550
OK so it's returning as a tuple you don't have to remember that just know how to use this.

211
00:12:28,610 --> 00:12:29,180
OK.

212
00:12:29,420 --> 00:12:35,780
And what it's going to do is it's going to pass in the key name and the value could also have said key

213
00:12:36,500 --> 00:12:37,490
and Val.

214
00:12:37,590 --> 00:12:37,940
OK.

215
00:12:37,940 --> 00:12:38,970
Same exact thing.

216
00:12:39,050 --> 00:12:44,150
So it's going to give us the key name and the value and it's going to go through the entire dictionary

217
00:12:44,180 --> 00:12:45,100
on each one of those.

218
00:12:45,110 --> 00:12:49,970
And there is an algorithm that goes underneath the hood that's efficient and grabbing this information

219
00:12:50,450 --> 00:12:53,450
although not as efficient as other ways of accessing information.

220
00:12:53,450 --> 00:12:59,480
In most cases in many cases you don't want to iterate through an entire list of dictionaries if you

221
00:12:59,480 --> 00:13:05,210
want to iterate through a list of something you know maybe an array is better data structure.

222
00:13:05,360 --> 00:13:10,630
You can definitely go through here and I have before so I'll say airport code.

223
00:13:10,820 --> 00:13:11,410
All right.

224
00:13:11,480 --> 00:13:17,800
And then we'll put up the last colon here and then we're going to say airport name.

225
00:13:18,330 --> 00:13:18,800
OK.

226
00:13:19,040 --> 00:13:24,060
So we're just going to go through and print the code in the name or the key and the value.

227
00:13:24,060 --> 00:13:24,630
And here it is.

228
00:13:24,640 --> 00:13:26,860
There is the key there is the value.

229
00:13:26,930 --> 00:13:31,680
There's the key there is the value key and value OK.

230
00:13:31,880 --> 00:13:33,930
Looking good that is good.

231
00:13:34,340 --> 00:13:34,730
All right.

232
00:13:34,730 --> 00:13:39,940
So there's our airport to airport name perfect.

233
00:13:40,450 --> 00:13:41,250
What else can we do.

234
00:13:41,260 --> 00:13:49,360
We can also just do the keys and values individually so for each airport code or we can even just say

235
00:13:49,360 --> 00:13:55,780
for each key an air port Stuckey's so you can print up the keys right.

236
00:14:01,740 --> 00:14:02,640
We can pass in the key

237
00:14:06,370 --> 00:14:14,840
pretty cool and we can also do the same thing with the values for each vowel in airports values values

238
00:14:14,860 --> 00:14:19,630
no valid just a variable that I've created a constant.

239
00:14:20,560 --> 00:14:20,860
You

240
00:14:24,590 --> 00:14:26,960
and organised pass and ballet here.

241
00:14:27,220 --> 00:14:31,050
OK so value value value so you can work with kids and values.

242
00:14:31,130 --> 00:14:33,330
The kids are unique.

243
00:14:33,510 --> 00:14:38,270
Mostly most of the time you're going to work with strings here and you're in your data types you can

244
00:14:38,270 --> 00:14:39,280
play around with other things.

245
00:14:39,290 --> 00:14:44,060
But one of the big uses of dictionaries is when you're working with Jason data that you're getting from

246
00:14:44,060 --> 00:14:48,560
the Internet it's going to come down in a bundle just on file and you're going to grab things by keys

247
00:14:48,560 --> 00:14:55,780
and values because Jason is very much similar to the notion of of dictionary keys and values.

248
00:14:55,910 --> 00:14:59,880
And if you don't know what I'm talking about let's just take a look at it right here.

249
00:14:59,930 --> 00:15:05,790
We can go to a Star Wars API that's this free API this one is created on the Internet.

250
00:15:05,820 --> 00:15:08,910
It has lots of information on it.

251
00:15:09,410 --> 00:15:11,560
And so right here it's pulling up some Jaison this one.

252
00:15:11,570 --> 00:15:13,040
Luke Skywalker.

253
00:15:13,040 --> 00:15:20,510
And so this is a dictionary where the keys are of type string.

254
00:15:20,510 --> 00:15:23,480
So here's a key called name of type string.

255
00:15:23,480 --> 00:15:28,710
So name the string Luke Skywalker the value type of this one is a string.

256
00:15:29,030 --> 00:15:32,630
Let's find one that's not a string here.

257
00:15:32,630 --> 00:15:34,910
These are all strings on here.

258
00:15:34,910 --> 00:15:40,580
Let's look at some of their other API features to show you how it's going to kind of translate in your

259
00:15:40,580 --> 00:15:41,210
code.

260
00:15:45,180 --> 00:15:46,090
Israel strings as well.

261
00:15:46,090 --> 00:15:47,120
They could also been numbers.

262
00:15:47,120 --> 00:15:55,380
This this company or this person chose to put all the values in as strings instead of numbers so that's

263
00:15:55,380 --> 00:16:00,180
really important to to understand is when you download information from the internet or Jason you have

264
00:16:00,180 --> 00:16:02,400
to abide by whatever they have created for you.

265
00:16:02,400 --> 00:16:08,310
So whereas I may have put this as a number in integer they chose to use a string for both the key and

266
00:16:08,310 --> 00:16:08,690
the value.

267
00:16:08,690 --> 00:16:10,930
There's another API that I like to work with as well.

268
00:16:11,220 --> 00:16:19,030
Hoquiam on our active pokie API OK another one that somebody put up which is kind of cool.

269
00:16:19,590 --> 00:16:21,830
And here's one perfect example so.

270
00:16:22,060 --> 00:16:24,500
So this is a dictionary object right.

271
00:16:24,660 --> 00:16:27,270
And the keys are all strings.

272
00:16:27,270 --> 00:16:29,480
But in this case the key is.

273
00:16:29,530 --> 00:16:35,310
So the key ID has a value that's a number it's an integer and base experience is an integer.

274
00:16:35,310 --> 00:16:38,010
Height is an integer is default is a boolean.

275
00:16:38,010 --> 00:16:41,260
So you can have a boolean value type.

276
00:16:41,490 --> 00:16:44,760
So this is this is interesting to look at this one on this one.

277
00:16:44,760 --> 00:16:52,020
The key name is a string but the value is an array.

278
00:16:52,020 --> 00:16:52,980
That's really interesting.

279
00:16:52,980 --> 00:16:54,240
Can we do that with swift.

280
00:16:54,240 --> 00:16:57,100
Like let's say we wanted to create abilities.

281
00:16:57,150 --> 00:16:58,390
That's really interesting.

282
00:16:58,590 --> 00:17:03,030
Let's give it a shot or it's var let's say abilities.

283
00:17:03,150 --> 00:17:04,560
Me a dictionary right.

284
00:17:04,590 --> 00:17:15,890
So the dictionary or the bill t's dictionary is going to be a dictionary of type string.

285
00:17:16,080 --> 00:17:23,160
And then what we're going to do is we're going to say an array and the array is going to be an array

286
00:17:23,160 --> 00:17:26,240
of what can be an array of dictionaries right.

287
00:17:26,670 --> 00:17:35,270
So let's see what it does here of type string and string.

288
00:17:35,270 --> 00:17:40,050
I'm just curious where the syntax is wrong here.

289
00:17:40,490 --> 00:17:47,780
But anyway my point here is you can have.

290
00:17:48,650 --> 00:17:52,750
You can have different items inside of your dictionaries.

291
00:17:52,760 --> 00:17:54,060
OK.

292
00:17:54,650 --> 00:18:03,710
Such as a boolean in OK you can do all kinds of different things with your dictionary so it doesn't

293
00:18:03,710 --> 00:18:06,740
have to just be strings and integers.

294
00:18:07,070 --> 00:18:10,280
So lots of cool stuff.

295
00:18:10,400 --> 00:18:12,280
This is just scratching the surface here.

296
00:18:12,410 --> 00:18:12,940
OK.

297
00:18:12,980 --> 00:18:17,420
Just touching the surface if you want to get a better synopsis of how dictionaries work again do that

298
00:18:17,420 --> 00:18:22,510
Google search I told you about how to hash tables work in computer science you can also go look at Jaison

299
00:18:22,510 --> 00:18:23,730
and start getting a feel.

300
00:18:23,760 --> 00:18:24,930
And I said based on that.

301
00:18:24,940 --> 00:18:31,320
J.S. Oh and get a feel of how things work with with weather and how it might translate to your.

302
00:18:31,880 --> 00:18:32,860
And that's it.

303
00:18:32,870 --> 00:18:34,180
Lots of good information.

304
00:18:34,460 --> 00:18:35,210
So good old man.

305
00:18:35,280 --> 00:18:39,080
And let's move on and forward price down slopes dotcom at CNN.

