1
00:00:01,460 --> 00:00:02,840
Hey What's up everybody.

2
00:00:02,880 --> 00:00:09,300
Mark Price slopes dot com plugging our way through foundational swift and programming them not only

3
00:00:09,300 --> 00:00:14,700
teach India SWIP but I'm teaching underlying core programming principles that you use with you in any

4
00:00:14,700 --> 00:00:15,540
programming language.

5
00:00:15,540 --> 00:00:17,200
So this is really good stuff.

6
00:00:17,220 --> 00:00:18,210
Take it in here.

7
00:00:18,240 --> 00:00:24,870
Go ahead and open up your X code 8 and we're going to get started with a playground and this one we're

8
00:00:24,870 --> 00:00:37,080
going to call bulls not to be confused with like a bull with horns bulls and conditionals and comparison

9
00:00:37,440 --> 00:00:39,160
operators.

10
00:00:41,780 --> 00:00:55,600
Create a folder for this swift and mostly tables and compare lists and account and create.

11
00:00:55,600 --> 00:01:00,440
So a boolean is true or false.

12
00:01:00,480 --> 00:01:02,710
Simple enough.

13
00:01:02,710 --> 00:01:07,140
So far we've kind of done this once before.

14
00:01:07,140 --> 00:01:07,410
Right.

15
00:01:07,410 --> 00:01:09,000
Bar.

16
00:01:09,870 --> 00:01:17,990
Am I in my the best teacher ever equals.

17
00:01:18,150 --> 00:01:20,800
What's that Jennifer says.

18
00:01:20,800 --> 00:01:21,270
True.

19
00:01:21,340 --> 00:01:22,450
Thanks Jennifer.

20
00:01:22,450 --> 00:01:22,740
OK.

21
00:01:22,740 --> 00:01:24,540
So am I the best teacher ever.

22
00:01:25,030 --> 00:01:25,780
Well thank you.

23
00:01:25,930 --> 00:01:30,620
I wouldn't say that about myself because that would be narcissistic.

24
00:01:30,700 --> 00:01:31,570
So that's a billion.

25
00:01:31,600 --> 00:01:32,380
It's true.

26
00:01:32,590 --> 00:01:37,140
And you know but it can also be false can be anything else so.

27
00:01:37,410 --> 00:01:39,270
So am I the best teacher ever.

28
00:01:39,270 --> 00:01:45,880
Well let's say the ExCo just keeps crashing and you're getting sick of watching me have X code crash

29
00:01:46,090 --> 00:01:47,130
and you're just angry.

30
00:01:47,170 --> 00:01:53,800
And so now you want to set this false because X Courcy's it's not my fault is crashing.

31
00:01:53,800 --> 00:01:56,470
Don't get on my case don't get on my case.

32
00:01:56,470 --> 00:01:58,310
So am I the best teacher ever.

33
00:01:58,570 --> 00:02:02,850
I'm no longer the best teacher ever because this keeps up to us.

34
00:02:03,250 --> 00:02:09,520
And you know I actually do cut out a lot of the a lot of the crashes but I at least some of them in

35
00:02:09,520 --> 00:02:14,440
there so you can know that again real life development you see in the flesh there.

36
00:02:14,440 --> 00:02:17,970
So am I the best teacher ever is now false because it keeps crashing.

37
00:02:18,010 --> 00:02:20,470
OK and I'm not cutting it out of the video.

38
00:02:21,190 --> 00:02:21,730
OK.

39
00:02:21,910 --> 00:02:23,770
Anyway so true or false.

40
00:02:23,800 --> 00:02:24,460
So what does that mean.

41
00:02:24,460 --> 00:02:26,960
Why does why does it mean that we are storing it.

42
00:02:27,070 --> 00:02:28,490
True or False variable.

43
00:02:28,900 --> 00:02:35,110
Well the funny thing is actually most of the time you're not storing true or false values in a variable.

44
00:02:35,110 --> 00:02:38,450
You will and I do it frequently but not all the time.

45
00:02:38,620 --> 00:02:47,980
Boolean values are sometimes more so used to just compare things or to not to do something based on

46
00:02:47,980 --> 00:02:49,230
some condition.

47
00:02:49,460 --> 00:02:51,080
OK.

48
00:02:51,370 --> 00:02:51,610
Right.

49
00:02:51,610 --> 00:02:54,120
Does that make any sense you want to do something based.

50
00:02:54,160 --> 00:02:54,970
Should I get this.

51
00:02:54,970 --> 00:03:01,910
You know if you know when you were a kid remember when you were a kid and your parents were like Yo

52
00:03:02,140 --> 00:03:07,450
if you clean your room and do your chores we're going to go to Disneyland otherwise I'm going to take

53
00:03:07,450 --> 00:03:09,960
this big black belt with these spikes on it.

54
00:03:09,970 --> 00:03:15,520
I'm going to beat you because a rough child anyway.

55
00:03:15,860 --> 00:03:17,780
Cause and effect or true or false.

56
00:03:17,840 --> 00:03:20,940
Bullying is a foundational principle for that.

57
00:03:21,640 --> 00:03:27,190
And this is again type inference here we're inferring it as well but the actual key word if you want

58
00:03:27,190 --> 00:03:30,430
to explicitly declare it is bull.

59
00:03:30,510 --> 00:03:30,920
OK.

60
00:03:31,000 --> 00:03:32,600
Not boolean.

61
00:03:32,760 --> 00:03:33,530
OK.

62
00:03:33,820 --> 00:03:36,000
Not boolean literal type converter but nothing else.

63
00:03:36,000 --> 00:03:36,880
OK just bull.

64
00:03:36,880 --> 00:03:38,460
And I'm not going to explain what these things are.

65
00:03:38,460 --> 00:03:43,630
If you're wondering what's the difference between bull and boolean Swift and I have the pop when autocomplete

66
00:03:43,630 --> 00:03:44,200
comes up.

67
00:03:44,290 --> 00:03:45,810
Go search on Google.

68
00:03:45,880 --> 00:03:47,910
I'm telling you all you ever need to use is blog.

69
00:03:48,130 --> 00:03:48,850
OK.

70
00:03:49,210 --> 00:03:50,640
So true or false.

71
00:03:50,770 --> 00:03:52,450
And how can you use these things well

72
00:03:56,440 --> 00:03:57,520
to make decisions for you.

73
00:03:57,520 --> 00:04:02,280
So that's it that's pulling ins.

74
00:04:02,770 --> 00:04:03,910
Let's put them in action.

75
00:04:03,910 --> 00:04:08,850
Let's actually see how we can use comparisons with.

76
00:04:09,190 --> 00:04:10,960
Well I can say one more thing actually.

77
00:04:11,380 --> 00:04:12,270
Just one more thing.

78
00:04:12,370 --> 00:04:13,170
OK.

79
00:04:13,510 --> 00:04:15,780
Just to blow your mind and confuse you completely.

80
00:04:16,090 --> 00:04:23,580
If true equals false or if true equals true.

81
00:04:24,620 --> 00:04:30,410
Print WITF this is what the fish.

82
00:04:30,430 --> 00:04:31,370
By the way.

83
00:04:31,750 --> 00:04:33,620
All right.

84
00:04:34,000 --> 00:04:35,640
What's going on here.

85
00:04:35,650 --> 00:04:39,610
So we're using the double equals sign here.

86
00:04:39,610 --> 00:04:43,240
This is a comparison operator and this is called equal to.

87
00:04:43,300 --> 00:04:47,220
So if true is equal to false.

88
00:04:47,230 --> 00:04:52,940
Ok if true is equal to false then this whole side of the equation would be true but it's not.

89
00:04:52,940 --> 00:04:57,490
So this whole side of the equation is false so we're saying if false or.

90
00:04:57,630 --> 00:05:06,220
OK this is the or operator OK and or if true equals true.

91
00:05:06,370 --> 00:05:10,400
So if this is true or if this is true then go into here.

92
00:05:10,900 --> 00:05:13,210
OK so true is definitely equal to true.

93
00:05:13,210 --> 00:05:16,450
So this is going to return the entire section over here to true.

94
00:05:16,780 --> 00:05:24,550
And so again you can start to see maybe how you can start comparing things in your code.

95
00:05:24,730 --> 00:05:31,120
And this is a great example because you probably wouldn't write this in your code but a lot of coding

96
00:05:31,120 --> 00:05:36,550
tests and brainteasers out there will actually ask you to decipher things like this.

97
00:05:36,550 --> 00:05:40,350
So you're you can they can see how your brain works and see if you can read the code.

98
00:05:40,360 --> 00:05:42,430
This is really good for learning how to read code.

99
00:05:42,580 --> 00:05:43,010
OK.

100
00:05:43,090 --> 00:05:45,070
So true or false.

101
00:05:45,400 --> 00:05:52,960
You know a better example is for instance var has data finished downloading you know how when you get

102
00:05:52,960 --> 00:05:57,810
an app and there's a spinner bar always explicitly declare it.

103
00:05:58,090 --> 00:05:59,560
So you can know it's a boolean.

104
00:05:59,560 --> 00:06:04,060
So basically when you get that spinner bar it's hitting up a server and it's downloading data.

105
00:06:04,120 --> 00:06:04,810
OK.

106
00:06:04,810 --> 00:06:10,080
So you know we've got the spinner and dot dot dot you know a little color that was nice.

107
00:06:10,090 --> 00:06:12,050
Got it.

108
00:06:12,610 --> 00:06:14,180
That's funny.

109
00:06:14,180 --> 00:06:14,880
Let's just pick a car.

110
00:06:14,880 --> 00:06:17,240
I don't know what it's doing to be honest but I like it.

111
00:06:17,260 --> 00:06:23,400
It's yellow it's a feature of a feature of the playgrounds anyway so we're Delanie data from the internet.

112
00:06:23,400 --> 00:06:29,010
Then after it's done downloading we can say has data finished downloading equals true.

113
00:06:29,210 --> 00:06:29,710
All right.

114
00:06:29,820 --> 00:06:35,580
And then we can do something like no load UI and other features.

115
00:06:35,910 --> 00:06:42,330
So this is an example of when you actually use a ball in your code and in your projects with for things

116
00:06:42,330 --> 00:06:48,100
like this and I've done things like this before it's nothing wrong with it it's a common thing to do.

117
00:06:48,120 --> 00:06:48,780
So it's boolean.

118
00:06:48,780 --> 00:06:49,880
True or false.

119
00:06:49,880 --> 00:06:56,520
It's one way you can use it again anytime anytime you need to get a true false yes or no Bullen's the

120
00:06:56,520 --> 00:07:04,230
way to go ball for short the bulls go hand in hand or boolean logic goes hand in hand with comparison

121
00:07:04,230 --> 00:07:08,970
operators can comparison operators will return a boolean.

122
00:07:09,110 --> 00:07:10,450
Hmm OK.

123
00:07:10,500 --> 00:07:15,180
When I say baleen it is Boole but bullying is the long term for it.

124
00:07:15,410 --> 00:07:30,320
With just condense it here so for instance this is real easy if one is equal to two print should not

125
00:07:30,360 --> 00:07:31,800
see this.

126
00:07:31,900 --> 00:07:36,580
OK so will never be executed.

127
00:07:36,600 --> 00:07:37,580
Thank you.

128
00:07:37,580 --> 00:07:38,460
It's smart.

129
00:07:38,460 --> 00:07:42,240
So if one equals two well one is not equal to two when the recall.

130
00:07:42,240 --> 00:07:44,280
So again this returns a boolean.

131
00:07:44,570 --> 00:07:45,080
OK.

132
00:07:45,300 --> 00:07:46,530
That's really interesting huh.

133
00:07:46,860 --> 00:07:49,110
I wonder do you think you could do something like that over here.

134
00:07:49,110 --> 00:07:52,440
Actually in in a in a boolean self.

135
00:07:52,440 --> 00:07:59,520
So what if we said instead of saying false we'll say Well said This has data finished downloading equals

136
00:07:59,610 --> 00:08:00,960
one equals to

137
00:08:03,730 --> 00:08:05,230
and resting.

138
00:08:05,640 --> 00:08:09,730
So like I said this is returning a boolean a true or false value that's been stored in here.

139
00:08:09,750 --> 00:08:16,020
So like I was telling me earlier you use them less here in variables and you use them more in conditional

140
00:08:16,020 --> 00:08:23,860
logic they return them only return a boolean for the sake of performing making a decision.

141
00:08:24,110 --> 00:08:24,380
OK.

142
00:08:24,390 --> 00:08:30,200
So if one equals to print you should not see this if two equals two.

143
00:08:30,210 --> 00:08:31,040
Now we're seeing it.

144
00:08:31,130 --> 00:08:31,720
OK.

145
00:08:32,050 --> 00:08:38,770
So it returns a false value conditional conditional logic.

146
00:08:38,770 --> 00:08:40,800
OK so let's talk about the different operators here.

147
00:08:40,930 --> 00:08:41,490
All right.

148
00:08:41,740 --> 00:08:46,690
So we've got equal to and it's the double equal sign OK.

149
00:08:47,110 --> 00:08:56,640
We've got not equal to which is the exclamation point and the equal sign not equal to.

150
00:08:56,650 --> 00:09:00,210
All right we've got greater than.

151
00:09:00,640 --> 00:09:02,210
And this is you know a.

152
00:09:02,340 --> 00:09:03,820
It's greater than B.

153
00:09:04,440 --> 00:09:07,130
So I say that's greater then.

154
00:09:07,130 --> 00:09:08,220
And I forgot my colon.

155
00:09:08,330 --> 00:09:09,560
It isn't.

156
00:09:10,240 --> 00:09:12,350
And then we've got greater.

157
00:09:12,880 --> 00:09:22,720
Greater than or equal to which is you know the big Pacman mouth to the left equal to and then we have

158
00:09:24,100 --> 00:09:26,620
less than or equal to

159
00:09:29,610 --> 00:09:30,510
like so.

160
00:09:31,110 --> 00:09:34,780
And then we've got less than two.

161
00:09:35,000 --> 00:09:35,310
OK.

162
00:09:35,400 --> 00:09:37,810
So obviously there's a lot going on here.

163
00:09:38,220 --> 00:09:39,700
But let's see how it actually works.

164
00:09:39,710 --> 00:09:40,610
Let's see it in action.

165
00:09:40,610 --> 00:09:41,190
OK.

166
00:09:41,440 --> 00:09:48,390
So of course the common example here that we've used already is a bank account so we can obviously do

167
00:09:48,390 --> 00:09:49,080
that here again.

168
00:09:49,080 --> 00:09:58,080
So our bank balance right equals are equals five $400 K our item to buy.

169
00:09:58,380 --> 00:10:00,120
Equals $100.

170
00:10:00,320 --> 00:10:01,050
OK.

171
00:10:01,300 --> 00:10:09,870
So then what we can do is we can say if bank balance bank balance is greater than or equal to item to

172
00:10:09,870 --> 00:10:15,470
buy Why wouldn't we just say if it's greater then well the ire of the buyer was $400.

173
00:10:15,510 --> 00:10:17,730
This would turn out to be false and we would be able to buy it.

174
00:10:17,730 --> 00:10:18,550
That's not right.

175
00:10:18,570 --> 00:10:23,610
We need to be able to go to zero dollars in our account but not into the negative unless you turn unless

176
00:10:23,610 --> 00:10:26,430
you put an overdraft protection you know which.

177
00:10:26,460 --> 00:10:27,810
Why did people do that.

178
00:10:27,810 --> 00:10:29,000
No frigging clue.

179
00:10:29,010 --> 00:10:29,960
Just what I wanted to do.

180
00:10:29,960 --> 00:10:36,740
I wanted to spend money I didn't have get the item and then have you charge me a negative fee.

181
00:10:36,810 --> 00:10:40,440
I mean I guess if you want to be embarrassed at the register because your card didn't go through and

182
00:10:40,440 --> 00:10:43,720
you're like I'm sorry sir your card didn't go through Was everything OK.

183
00:10:43,740 --> 00:10:46,480
Do you need any help with your family.

184
00:10:46,560 --> 00:10:47,260
No.

185
00:10:47,340 --> 00:10:53,220
So anyway my point is we need the equal to sign so we can actually buy the item the item to buy.

186
00:10:53,950 --> 00:10:54,400
OK.

187
00:10:54,600 --> 00:10:57,490
Then print purchased item.

188
00:10:57,670 --> 00:10:58,300
OK.

189
00:10:58,470 --> 00:11:05,100
So if you've got more money or equal to or an equal amount of money then by print purchase item.

190
00:11:05,210 --> 00:11:15,880
Another thing we could do you know we could say if item to buy is greater than the bank balance

191
00:11:19,050 --> 00:11:23,620
you need more money to.

192
00:11:24,660 --> 00:11:25,080
So

193
00:11:28,300 --> 00:11:32,710
if Ireland buy is great the balance you need more money for this and we're using a greater than only

194
00:11:32,720 --> 00:11:37,090
sign so let's say the item to buy is now five hundred dollars.

195
00:11:37,720 --> 00:11:39,380
Sure enough it prints out right here.

196
00:11:39,640 --> 00:11:40,360
OK this is cool.

197
00:11:40,370 --> 00:11:43,120
So so far we've used greater than or equal to.

198
00:11:43,210 --> 00:11:47,430
We've also used the greater than sign here.

199
00:11:47,660 --> 00:11:48,520
OK.

200
00:11:48,640 --> 00:11:58,390
And maybe maybe your bank whenever you whenever you hit zero for instance it wants to give you a notification

201
00:11:58,390 --> 00:12:00,760
saying hey you're in no money.

202
00:12:00,790 --> 00:12:01,520
You spend it all.

203
00:12:01,520 --> 00:12:08,800
You know so you know this is a silly example but we can say if item to buy is equal to bank balance.

204
00:12:09,000 --> 00:12:10,090
OK.

205
00:12:10,240 --> 00:12:19,540
And then what we can do is we can say print Hey buddy your balance is now zero.

206
00:12:20,190 --> 00:12:21,040
OK.

207
00:12:21,160 --> 00:12:24,130
So I'd advise the bank balance Hey buddy your balance is now zero.

208
00:12:24,130 --> 00:12:28,510
So if I say I'm the buy is $400.

209
00:12:29,280 --> 00:12:30,670
Hey buddy your balance is now zero.

210
00:12:30,670 --> 00:12:35,680
So if this is equal to this OK then do this.

211
00:12:35,680 --> 00:12:42,850
Now remember remember these operators here OK are returning a true or false value.

212
00:12:42,850 --> 00:12:43,170
OK.

213
00:12:43,180 --> 00:12:46,250
So remember you could actually store this in a variable.

214
00:12:46,300 --> 00:12:55,800
So for instance var am I at zero equals I want to buy people's bank balance.

215
00:12:55,840 --> 00:12:56,160
OK.

216
00:12:56,170 --> 00:12:58,840
So it's going to run this operation first.

217
00:12:59,410 --> 00:13:02,860
And then what it's going to do is it's going to return a true or false value into this.

218
00:13:02,860 --> 00:13:06,010
And this is a and so you can actually store the result if you want it to.

219
00:13:06,010 --> 00:13:08,770
But again like I said in most cases you don't.

220
00:13:08,830 --> 00:13:09,450
OK.

221
00:13:09,730 --> 00:13:12,890
And then let's see here.

222
00:13:12,970 --> 00:13:20,110
The only other one of great importance is the not equal to sign so I'll show you that as well to friends

223
00:13:20,110 --> 00:13:23,450
and also we want to compare instead of numbers we want to compare strings.

224
00:13:23,470 --> 00:13:34,980
So if let's say correct spelling is not equal to

225
00:13:38,610 --> 00:13:47,080
and let's actually better save our word one equals Let's get this let's say this are book titles case

226
00:13:47,100 --> 00:14:07,550
so book title one equals let's say Harry Potter and the Moffit of Mier on my book.

227
00:14:07,780 --> 00:14:08,020
OK.

228
00:14:08,020 --> 00:14:14,620
Anyway and then we have a book titled two equals unless we have the same thing here but this one's entered

229
00:14:14,620 --> 00:14:15,500
by a user.

230
00:14:15,550 --> 00:14:18,710
OK this one was entered by a user they knew would be the same thing right.

231
00:14:18,940 --> 00:14:24,190
So let's say that the user action in lowercase this and you know if forgot got a you know there's bad

232
00:14:24,190 --> 00:14:38,140
spelling so we can do is we can say if Book Title One is not equal to book title to you know print need

233
00:14:38,140 --> 00:14:42,930
to fix spelling before printing whatever.

234
00:14:43,550 --> 00:14:44,010
OK.

235
00:14:44,320 --> 00:14:48,870
So if this one is not the same as this one then do something else.

236
00:14:48,880 --> 00:14:49,580
OK.

237
00:14:49,820 --> 00:14:53,660
So it's basically the opposite of using these here.

238
00:14:53,770 --> 00:14:54,020
OK.

239
00:14:54,030 --> 00:14:57,030
And you can you'll see programmers use these interchangeably.

240
00:14:57,100 --> 00:15:02,590
And you can kind of sometimes you can do to get the same result in decision using different operators

241
00:15:02,770 --> 00:15:04,970
just depending on what you put first or second.

242
00:15:04,990 --> 00:15:08,150
But you can do whatever one you want which is cool.

243
00:15:08,160 --> 00:15:09,820
So this is all really cool.

244
00:15:09,820 --> 00:15:13,630
This is really cool stuff.

245
00:15:13,630 --> 00:15:19,850
Another thing you can do is remember how we did this example up here has day to finish downloading.

246
00:15:19,910 --> 00:15:28,990
You can also use that unary operators so we could say if our first let's let's do it with stood up here

247
00:15:30,220 --> 00:15:31,700
before it's been set to true.

248
00:15:31,870 --> 00:15:38,100
So if not has data finished downloading.

249
00:15:38,430 --> 00:15:45,560
OK then print loading data.

250
00:15:45,580 --> 00:15:50,800
So at this point in time if the data has not finished downloading let's print to the screen loading

251
00:15:50,800 --> 00:15:51,070
data.

252
00:15:51,070 --> 00:15:56,430
So this is the operator put before the boolean value.

253
00:15:56,440 --> 00:15:57,700
And so it's saying the opposite.

254
00:15:57,700 --> 00:15:57,970
Right.

255
00:15:57,970 --> 00:16:03,730
So that's why it's so important to word your variables with your Bulleen so carefully so has data finish

256
00:16:03,730 --> 00:16:04,290
downloading.

257
00:16:04,300 --> 00:16:05,440
That's the question we're asking.

258
00:16:05,440 --> 00:16:09,610
So if the data has not finished Etling that's what this is saying here.

259
00:16:09,610 --> 00:16:11,330
Print this here OK.

260
00:16:11,650 --> 00:16:13,090
Print loading data.

261
00:16:13,090 --> 00:16:14,380
Pretty cool stuff right.

262
00:16:14,380 --> 00:16:18,070
So what we've done here so far is we've just used some of the basic operators of course we've used the

263
00:16:18,070 --> 00:16:20,840
greater than or equal to you can also use the less than or equal to.

264
00:16:20,920 --> 00:16:26,260
And you can start making decisions based on those operators.

265
00:16:26,290 --> 00:16:26,550
OK.

266
00:16:26,560 --> 00:16:32,640
The result of those operators which is I think pretty dang cool.

267
00:16:32,650 --> 00:16:35,890
One more thing I want to show you and then we'll be done.

268
00:16:35,890 --> 00:16:39,990
So if Book Title 1 is not equal the book title to.

269
00:16:40,550 --> 00:16:44,450
OK then we need to fix spelling before printing great else.

270
00:16:44,560 --> 00:16:45,400
There's the key word.

271
00:16:45,400 --> 00:16:48,940
So if this happens or if this is true great.

272
00:16:48,970 --> 00:16:54,200
If not go to the next block of code and this will always always always be executed.

273
00:16:54,700 --> 00:17:01,930
If this is false and this will never ever ever be executed if this is true it very important to know.

274
00:17:02,340 --> 00:17:13,900
And so that you say print book looks great send to enter pretty corporate book title on non-equal the

275
00:17:13,900 --> 00:17:18,780
book title too great we can do more though like we can also say.

276
00:17:19,390 --> 00:17:24,010
So if so the first thing we want to do is check the spelling then what we want to do is we want to make

277
00:17:24,010 --> 00:17:28,040
sure that the size of the book title is a proper size.

278
00:17:28,300 --> 00:17:28,690
We can say.

279
00:17:28,690 --> 00:17:30,580
Else if ok.

280
00:17:30,820 --> 00:17:33,350
Book Title 1 thought.

281
00:17:33,430 --> 00:17:37,580
See or at length on a string here.

282
00:17:40,970 --> 00:17:41,570
See

283
00:17:53,670 --> 00:17:54,480
and far.

284
00:17:54,710 --> 00:18:05,270
Oh characters has the string and the characters and the goodness so if the count of the entire string

285
00:18:05,270 --> 00:18:15,140
is greater then let's say 10 like the one we need to do is print find a new title for the book.

286
00:18:16,010 --> 00:18:16,770
OK.

287
00:18:17,300 --> 00:18:18,620
So that's interesting.

288
00:18:18,620 --> 00:18:24,630
So look what we did here in the book one title or the book title one is like with a book title to them

289
00:18:24,650 --> 00:18:26,140
we need to send us the printing.

290
00:18:26,450 --> 00:18:27,810
Well let's say that we fixed it.

291
00:18:27,840 --> 00:18:29,690
All right so this is great we've just fixed it.

292
00:18:29,690 --> 00:18:33,960
The book is now perfectly edited whatever.

293
00:18:34,520 --> 00:18:35,440
But look here.

294
00:18:35,480 --> 00:18:37,390
Find a new title for your book is now called.

295
00:18:37,400 --> 00:18:38,000
OK.

296
00:18:38,210 --> 00:18:40,410
So we passed the first one this is true.

297
00:18:40,760 --> 00:18:47,130
So then we go to the next thing or excuse me this is false and therefore it's not called.

298
00:18:47,570 --> 00:18:48,490
This is false.

299
00:18:48,580 --> 00:18:54,310
So else if book titled two characters that count is greater than 10.

300
00:18:54,560 --> 00:18:55,200
Oh no.

301
00:18:55,310 --> 00:18:56,510
We need to find a new title for the book.

302
00:18:56,510 --> 00:18:58,220
This is too long it's not going to fit on the book.

303
00:18:58,450 --> 00:19:04,790
OK so we need a book that has nine characters in order in order to get to here to the else clause so

304
00:19:05,390 --> 00:19:10,960
let's say one two three four five count the space that's a character six seven eight nine.

305
00:19:11,010 --> 00:19:12,350
Oh wow.

306
00:19:12,350 --> 00:19:20,430
So Harry Potter and the muppet of fire was his turn nary below what does book's about anymore.

307
00:19:20,750 --> 00:19:25,440
But the editors thought it might be a little more appropriate to add a G there instead.

308
00:19:25,440 --> 00:19:32,330
So we've got some crazy book that we've released the title on and now look see if we pass it here.

309
00:19:32,330 --> 00:19:37,170
So if book titled to the characters that count is greater than 10.

310
00:19:37,280 --> 00:19:40,280
Print a new title for the book.

311
00:19:40,280 --> 00:19:45,860
And of course we need to copy this over here because it needs to be the same again.

312
00:19:46,250 --> 00:19:49,680
So if book titles are not equal to book title too well it is.

313
00:19:49,680 --> 00:19:53,810
So this is false or am I going to call this LCF book title that characters that count is greater than

314
00:19:53,810 --> 00:19:54,340
10.

315
00:19:54,390 --> 00:19:55,910
We fix that problem too.

316
00:19:56,030 --> 00:19:57,720
So this is going to be false.

317
00:19:57,740 --> 00:20:03,350
So here's the end all catch all so once we pass those conditions it is now true and we're able to print

318
00:20:03,350 --> 00:20:03,970
the book.

319
00:20:04,140 --> 00:20:08,330
OK so we've worked with if statements else if statements else statements.

320
00:20:08,330 --> 00:20:14,550
We've worked with these conditional operators here OK that double equals the greater than the greater

321
00:20:14,550 --> 00:20:15,290
than equal.

322
00:20:15,290 --> 00:20:18,550
We've also talked about less than and less than or equal to.

323
00:20:19,250 --> 00:20:20,910
We know a lot of stuff here.

324
00:20:20,990 --> 00:20:25,530
We've talked about the urinary not OPERATOR OK the prefix here.

325
00:20:25,940 --> 00:20:32,960
If it's not finished downloading we're talking about booleans and true or false and how this will equate

326
00:20:32,960 --> 00:20:34,840
to a true or false.

327
00:20:34,850 --> 00:20:36,710
Some really good stuff so we're going to call this video done.

328
00:20:36,710 --> 00:20:37,640
It's a lot to take in.

329
00:20:37,640 --> 00:20:43,730
Watch it again and you're going to start using conditions in your applications because that's how applications

330
00:20:44,330 --> 00:20:48,810
make decisions is by using tools.

331
00:20:48,930 --> 00:20:52,590
Mark Price does Loeb's dotcom moving on and forward.
