1
00:00:00,530 --> 00:00:08,270
Hello this is Martez or Curdy and it is really really going to actually make is it equal Potten work.

2
00:00:08,330 --> 00:00:13,410
So just open your a calculator calculator job fine.

3
00:00:13,670 --> 00:00:15,530
And here we have the uncle of it.

4
00:00:15,740 --> 00:00:18,220
So if you go inside is switch statement.

5
00:00:18,230 --> 00:00:22,030
We have this case are that ID that PTEN equal.

6
00:00:22,160 --> 00:00:25,530
So now inside this case we are going to call.

7
00:00:25,640 --> 00:00:28,730
Operator is tapped method.

8
00:00:28,910 --> 00:00:34,240
And we're going to pass the the equal operator as the argument to this method.

9
00:00:34,490 --> 00:00:36,440
So operator that you call.

10
00:00:36,800 --> 00:00:39,370
So now that's enough.

11
00:00:39,380 --> 00:00:39,890
OK.

12
00:00:40,100 --> 00:00:46,400
Just calling this if it is enough in order to make a disobedient equal work because then this method

13
00:00:46,400 --> 00:00:53,180
is called here the operator is tapped is called and are actually passing the equal operator to this

14
00:00:53,180 --> 00:00:54,010
method.

15
00:00:54,350 --> 00:01:00,440
First as you can see the current operator is not equal to not because the equal operator is actually

16
00:01:00,440 --> 00:01:04,240
passed because or some operation has actually been executed.

17
00:01:04,340 --> 00:01:06,160
So the current operator is not not.

18
00:01:06,500 --> 00:01:11,780
And if it is not then it's not going to actually secure this if statement is it's going to actually

19
00:01:11,780 --> 00:01:15,030
be assigned a current number to this street number at.

20
00:01:15,080 --> 00:01:16,130
Right.

21
00:01:16,610 --> 00:01:21,590
And then it's going to actually set the empty value to this current number variable.

22
00:01:21,650 --> 00:01:24,580
And this switch statement is going to be executed.

23
00:01:24,590 --> 00:01:27,140
So now let me show you the emulator here.

24
00:01:27,140 --> 00:01:29,100
For example we have number five.

25
00:01:29,220 --> 00:01:29,780
OK.

26
00:01:29,870 --> 00:01:33,210
Number five multiplied by two.

27
00:01:33,510 --> 00:01:34,010
OK.

28
00:01:34,100 --> 00:01:36,920
And now I'm going to press on this equal button.

29
00:01:36,950 --> 00:01:39,220
The result is going to be output to the console.

30
00:01:39,470 --> 00:01:45,010
So here when I say this switch statement is going to be executed.

31
00:01:45,170 --> 00:01:51,110
So first you can see that the current number is going to be assigned to this strange number.

32
00:01:51,110 --> 00:01:51,470
That's right.

33
00:01:51,470 --> 00:01:52,690
So here we have the number 10.

34
00:01:52,760 --> 00:01:53,220
OK.

35
00:01:53,480 --> 00:01:59,930
But now when the switch statement is going to be executed it is switching between the values of the

36
00:01:59,930 --> 00:02:01,640
current operator.

37
00:02:01,910 --> 00:02:07,160
When I say the current operator is that it doesn't mean that the current operator is actually equal

38
00:02:07,520 --> 00:02:15,710
operator because at the end of this operator is that method we are going to update the value of this

39
00:02:15,980 --> 00:02:17,660
current operator variable.

40
00:02:17,870 --> 00:02:23,780
So at the end of the Smurfette here you can see in line number of 199 you are assigning the tapped operator

41
00:02:23,780 --> 00:02:25,160
to the current operator.

42
00:02:25,160 --> 00:02:32,730
So for example when I say 5 multiplied multiplied by two.

43
00:02:33,140 --> 00:02:33,800
OK.

44
00:02:33,800 --> 00:02:42,260
Now if I press on is equal button here it doesn't mean that now the current is equal but equal operator

45
00:02:42,470 --> 00:02:43,760
is the current operator.

46
00:02:43,780 --> 00:02:45,800
Is that just a tapped operator.

47
00:02:46,220 --> 00:02:53,310
The current operator is that multiplication operator that I pressed before this equal operator.

48
00:02:53,630 --> 00:02:55,990
So now here let's actually circle with.

49
00:02:56,040 --> 00:02:56,820
Here it says.

50
00:02:56,840 --> 00:02:58,730
So each count operator.

51
00:02:58,910 --> 00:03:04,100
So it's going to switch between the values of the current operator in our case we said that.

52
00:03:04,100 --> 00:03:06,500
So let me just explain again.

53
00:03:06,500 --> 00:03:10,840
We said to multiply it by five.

54
00:03:10,890 --> 00:03:15,520
In anti-state current operator is multiplication operator right.

55
00:03:15,680 --> 00:03:21,800
So here it's going to actually take a look at this case statement case multiply and it's going on just

56
00:03:22,460 --> 00:03:27,390
calculates the result at street number left multiplied by a string number that's right.

57
00:03:27,530 --> 00:03:32,450
And the result is going to be assigned to these calculations the result variable.

58
00:03:32,450 --> 00:03:32,940
Right.

59
00:03:33,020 --> 00:03:35,920
And then it's going to go down here after this.

60
00:03:35,930 --> 00:03:41,900
Any curly brace is going to update the value of this string number that's left by actually assigning

61
00:03:41,900 --> 00:03:43,950
the calculation result to this variable.

62
00:03:44,270 --> 00:03:47,260
And then the value is going to be displayed on the screen.

63
00:03:47,420 --> 00:03:51,360
So test results that said text string number at left.

64
00:03:51,510 --> 00:03:57,860
And finally we are actually updating the value of these calculations strange in order in order to show

65
00:03:57,860 --> 00:04:00,020
this value to the user at the top here.

66
00:04:01,240 --> 00:04:07,850
So now we can actually run the app and here you can see that after executing these lines of code here

67
00:04:07,910 --> 00:04:14,770
this statement here is not going to be executed because the current operator is not equal to null.

68
00:04:14,780 --> 00:04:20,300
If an operation is actually occurring and then the task of Rotary is going to be the current OPERATOR

69
00:04:20,870 --> 00:04:21,370
OK.

70
00:04:21,470 --> 00:04:25,520
So now we can actually run the app.

71
00:04:25,550 --> 00:04:31,420
We can't say run and let me show you the emulator.

72
00:04:31,430 --> 00:04:39,180
So for example if you have number five multiply by two here now I'm going to press on this this one

73
00:04:39,230 --> 00:04:40,700
this call button.

74
00:04:41,070 --> 00:04:44,460
Now the result is and with it here to the screen.

75
00:04:44,700 --> 00:04:45,170
OK.

76
00:04:45,390 --> 00:04:52,790
So now you can't I told you that the current operator is going to be the tapped OPERATOR Right.

77
00:04:53,190 --> 00:04:53,600
OK.

78
00:04:53,880 --> 00:04:56,140
So now I'm going to say number 10.

79
00:04:56,160 --> 00:05:04,700
He had to resolve it multiplied by two equal operator and now our application is crashed.

80
00:05:04,710 --> 00:05:09,780
So this means that there is a bug inside our application.

81
00:05:09,810 --> 00:05:13,940
First of all it's in order to find the bug we need to take a look at the locks.

82
00:05:13,950 --> 00:05:16,640
The first step is to take a look at the locks.

83
00:05:16,740 --> 00:05:20,230
So at that point I'm going to click on this Lochhead here.

84
00:05:20,580 --> 00:05:22,790
So let me show you the locks.

85
00:05:23,010 --> 00:05:24,470
And here it says.

86
00:05:24,570 --> 00:05:26,790
Let me actually show you here.

87
00:05:27,870 --> 00:05:33,120
So now here we're going to take a look at the right texts.

88
00:05:33,280 --> 00:05:40,560
Actually the it takes are going to show you are the exact park the fatal exception.

89
00:05:40,590 --> 00:05:46,950
And here it says that there is a number format the exception for input screen empty screen.

90
00:05:46,950 --> 00:05:48,870
Here you can see that here.

91
00:05:49,470 --> 00:05:56,660
And we've got two links actually the first one is calculator file Java line.

92
00:05:56,690 --> 00:06:03,010
If you click on it it's going to actually highlight the operator is tapped method calling him for the

93
00:06:03,010 --> 00:06:09,100
speedy and equal case and the next one is actually the triangulated job.

94
00:06:09,270 --> 00:06:11,190
One hundred and sixty.

95
00:06:11,190 --> 00:06:13,190
The air is accurate here.

96
00:06:13,440 --> 00:06:15,680
And you can see that this three numbers at lift.

97
00:06:15,680 --> 00:06:20,090
Valuable is highlighted so there is something right here inside the arch of light.

98
00:06:20,160 --> 00:06:25,110
So let me close at this last check here in order to find the bag.

99
00:06:25,530 --> 00:06:32,250
We don't have to look through the codes in order to find the bag and kill it so that our application

100
00:06:32,250 --> 00:06:33,000
works.

101
00:06:33,000 --> 00:06:35,400
That's not how it is designed.

102
00:06:35,400 --> 00:06:37,100
That's not how it works.

103
00:06:37,110 --> 00:06:44,140
We've got debugging tools at our hands that we can use it in order to find the bug and solve it.

104
00:06:44,160 --> 00:06:48,480
So how we can actually use these debugging tools.

105
00:06:48,480 --> 00:06:56,960
So first of all we know that US there is something wrong with our sync number lift method or variable

106
00:06:57,000 --> 00:06:57,600
actually.

107
00:06:58,020 --> 00:07:05,970
So I'm going to create a debugging point of red point here for this operator is Taft's of Meffert.

108
00:07:06,090 --> 00:07:12,930
So in line number of 148 here when I actually create this method uprated is that I'm going to create

109
00:07:13,380 --> 00:07:17,190
our red point for this effect.

110
00:07:17,230 --> 00:07:24,980
It is called a debugging point so that we can actually debug from this line of code.

111
00:07:25,080 --> 00:07:30,350
And then we can actually step by step by step see what's wrong with our coats.

112
00:07:30,390 --> 00:07:32,970
So now I'm going out run the app I'm going to.

113
00:07:33,030 --> 00:07:34,080
So I'm not going to run the app.

114
00:07:34,080 --> 00:07:35,370
We've got another option.

115
00:07:35,410 --> 00:07:37,160
We've got debug the app.

116
00:07:37,200 --> 00:07:44,710
You can see this one here a bug a great bug and you can see this play about it here on this great park.

117
00:07:44,730 --> 00:07:48,910
So just click on this one unless he has an emulator and then click on it.

118
00:07:49,840 --> 00:07:51,530
Let me show you the emulator.

119
00:07:52,060 --> 00:07:54,000
So it's it's as is waiting for people here.

120
00:07:54,010 --> 00:07:56,120
So let's wait now it is ready.

121
00:07:56,230 --> 00:07:57,990
Now I have number five.

122
00:07:58,240 --> 00:07:58,590
OK.

123
00:07:58,600 --> 00:08:02,600
So I'm going to just click on number five multiplied.

124
00:08:02,950 --> 00:08:05,480
So now the debulking is started.

125
00:08:05,770 --> 00:08:11,890
So if you're going to step by step see what's wrong with our code and see exactly how to debug the app

126
00:08:12,500 --> 00:08:13,200
now.

127
00:08:13,330 --> 00:08:19,400
Team effort OPERATOR This is actually called because I clicked on this multiplication operator.

128
00:08:19,480 --> 00:08:25,200
So that's why the debugging is now started because I created this red point for this method.

129
00:08:25,210 --> 00:08:30,170
Operator Is that here we have some options some icons.

130
00:08:30,190 --> 00:08:36,870
The first one says step over step over is going to execute the current code.

131
00:08:36,880 --> 00:08:40,270
The current line of code in its entirety.

132
00:08:40,410 --> 00:08:46,660
So we're going to execute that line of code in its entirety so that we can step over as you can see

133
00:08:47,500 --> 00:08:51,640
it wanted to actually execute this line of code.

134
00:08:51,790 --> 00:08:54,810
If current operator is not equal to no.

135
00:08:54,880 --> 00:09:01,330
So the current operator is actually not all because of an I pressed on this multiplication operator

136
00:09:01,550 --> 00:09:03,750
are the current operator is null.

137
00:09:03,910 --> 00:09:08,050
We have a tapped OPERATOR So you can see that it's as the tag the operator is multiply.

138
00:09:08,210 --> 00:09:10,880
But the current operator is not.

139
00:09:10,990 --> 00:09:14,060
So this if statement here is not going to be executed.

140
00:09:14,230 --> 00:09:19,690
So the flow of the program is going to go in so it is else that it isn't right and it's going to execute

141
00:09:19,690 --> 00:09:20,380
this line of code.

142
00:09:20,380 --> 00:09:22,970
It says string number at lift.

143
00:09:23,150 --> 00:09:26,840
Assignment operator current number.

144
00:09:26,890 --> 00:09:29,750
So we've got the current number which is number five.

145
00:09:30,040 --> 00:09:31,080
And here you can see that here.

146
00:09:31,080 --> 00:09:33,110
So it has a number that is not.

147
00:09:33,250 --> 00:09:35,270
And you've got a kind of number which is number five.

148
00:09:35,470 --> 00:09:39,000
So the number five is going to be assigned to the string number at left.

149
00:09:39,070 --> 00:09:44,890
If I could kind of step over now this line of code is going to be executed and the number 5 is going

150
00:09:44,890 --> 00:09:46,720
to be assigned to this number Atlas.

151
00:09:46,800 --> 00:09:48,440
So let me click on it.

152
00:09:48,480 --> 00:09:51,530
Now it's going to say that there's three numbers is number five.

153
00:09:51,910 --> 00:09:56,910
And here we want to assign an empty string value to this column number valuable.

154
00:09:57,100 --> 00:10:03,100
So it says that the current value of the current number value is 5 but then it this line of code here

155
00:10:03,100 --> 00:10:08,440
is going to be executed of this line of code is executed the empty value the empty string value is going

156
00:10:08,440 --> 00:10:10,540
to be assigned to this kind of number right.

157
00:10:10,870 --> 00:10:12,540
So let me click on this over.

158
00:10:12,790 --> 00:10:21,920
Now are we just see if they actually hover over this number here we can see that an empty string value

159
00:10:21,920 --> 00:10:24,850
is a science that is valuable.

160
00:10:24,900 --> 00:10:30,310
Now I was going to ask you this line of code the tap's operator is going to be assigned to the current.

161
00:10:30,410 --> 00:10:32,290
OPERATOR OK.

162
00:10:32,540 --> 00:10:38,870
So now the card operator is going to be the multiplication operator.

163
00:10:38,870 --> 00:10:44,120
So if I show you the emulator and now if I click on this step over.

164
00:10:44,360 --> 00:10:49,110
Now it says the current operator is multiply the top rated is also multiplied right.

165
00:10:49,160 --> 00:10:53,390
So now is it reached to the end of this method.

166
00:10:53,390 --> 00:10:54,920
Now if I click on that over again.

167
00:10:55,110 --> 00:11:03,050
Now you can see that this line of cohered is executed the operator is tapped and you can see that it's

168
00:11:03,050 --> 00:11:06,020
going to assign this value to this variable calculation string.

169
00:11:06,020 --> 00:11:11,660
So there is not there is nothing wrong with our calculations or the calculations.

170
00:11:11,900 --> 00:11:15,350
So if going to just resume the program.

171
00:11:15,350 --> 00:11:20,450
So at the left hand side you can see these left sidebar of this debulking area.

172
00:11:20,530 --> 00:11:22,370
It is a resume program.

173
00:11:22,370 --> 00:11:24,800
So let's click on resume program.

174
00:11:25,030 --> 00:11:30,210
So it might be five multiplied by for example 6.

175
00:11:30,250 --> 00:11:32,380
Now I'm going to click on this equal.

176
00:11:32,410 --> 00:11:33,710
Operator.

177
00:11:33,880 --> 00:11:35,890
So again the operator is tapped.

178
00:11:36,010 --> 00:11:37,260
Method is called.

179
00:11:37,480 --> 00:11:38,080
OK.

180
00:11:38,080 --> 00:11:44,750
So that it's going to again take a look at this if statement if current operator is not equal to not.

181
00:11:44,770 --> 00:11:49,590
So the current operator is not equal to now because the current operator is the multiplication operator

182
00:11:50,560 --> 00:11:54,470
and the current number is not equal to an empty stream.

183
00:11:54,520 --> 00:11:56,280
Value.

184
00:11:56,300 --> 00:12:04,400
So it says true the current number is not equal to actually an empty string value.

185
00:12:04,430 --> 00:12:10,100
So it is true you can see that this value here because we press undersexed number sets.

186
00:12:10,130 --> 00:12:17,810
So if I click on step over this if statement evaluates to true and is going to execute this if statement

187
00:12:17,810 --> 00:12:19,870
is going to actually is the this line of code.

188
00:12:19,970 --> 00:12:22,960
So the cost number is going to be assigned to district number.

189
00:12:22,970 --> 00:12:23,490
That's right.

190
00:12:23,510 --> 00:12:24,920
The current Nobody is number six.

191
00:12:24,920 --> 00:12:32,570
So if I can step over we can see that it is screen number X-Rite is sex and about the current value

192
00:12:32,570 --> 00:12:34,250
of the current number is 6.

193
00:12:34,250 --> 00:12:37,930
Now we want to assign an interesting value to the kind of number.

194
00:12:38,150 --> 00:12:42,790
So if I click on that over now it is the kind of number value is empty string.

195
00:12:43,070 --> 00:12:45,000
So now going to execute the switch statement.

196
00:12:45,020 --> 00:12:47,570
Let's get this step over.

197
00:12:47,780 --> 00:12:53,790
So we know that the counter-protest is multiply so it's going to execute this case multiply.

198
00:12:54,300 --> 00:13:00,420
And here we are going to actually you can see that it says our calculation result is zero the value

199
00:13:00,420 --> 00:13:04,670
of this variable is zero and the string length is 5.

200
00:13:04,670 --> 00:13:07,820
So let me kind of step over now.

201
00:13:07,850 --> 00:13:11,400
It says now that we have five I think number three is six.

202
00:13:11,450 --> 00:13:13,990
OK because we press on number 6.

203
00:13:14,210 --> 00:13:20,940
So if I can step over now the calculations result is going to be the value of the calculation.

204
00:13:20,950 --> 00:13:22,980
The result is going to be 50.

205
00:13:23,270 --> 00:13:29,180
So let me show you that here's the number if these five calculation result is 50 so you want to assign

206
00:13:29,510 --> 00:13:33,980
the value of the calculation results to the string number at left here.

207
00:13:34,010 --> 00:13:42,350
So if you click on this step over this line of code is executed it says change relations result 40 and

208
00:13:43,250 --> 00:13:44,720
it's going to secure this value.

209
00:13:44,840 --> 00:13:50,710
So it's going to output the value of the string number at left of the screen.

210
00:13:50,790 --> 00:13:53,670
And finally it's going to be the cutest line I've got here.

211
00:13:53,880 --> 00:14:01,800
So and finally here after these these lines of code is going to assign the tapped operator to the current

212
00:14:01,800 --> 00:14:08,070
operator so that half the operator is actually equal we can see that here the equal of right is going

213
00:14:08,070 --> 00:14:11,050
to be assigned to this current operator.

214
00:14:11,070 --> 00:14:13,080
So effectively conc that over again.

215
00:14:13,080 --> 00:14:16,700
Now this line of code is executed the current operator is equal.

216
00:14:16,950 --> 00:14:23,460
And now I'm going to click on the over again so you can see that this line of code here is actually

217
00:14:23,460 --> 00:14:26,830
going to be executed equal.

218
00:14:26,910 --> 00:14:32,210
And here because the operator restaffed and we said operator that equal and beep at Preston the equal

219
00:14:33,330 --> 00:14:34,200
button.

220
00:14:34,230 --> 00:14:38,320
So we're going to click on this over again.

221
00:14:38,790 --> 00:14:40,450
And finally it's going to secure the line of code.

222
00:14:40,450 --> 00:14:46,920
So there is nothing wrong with our takes the triangulation So if you're going to just resume the program

223
00:14:46,920 --> 00:14:52,050
resume program by just clicking on the play button here inside this debugging area.

224
00:14:52,050 --> 00:14:55,400
So not the number 50 here is out with it with this screen.

225
00:14:55,590 --> 00:14:56,400
OK.

226
00:14:57,240 --> 00:15:01,070
So now we have number 50 as the result.

227
00:15:01,080 --> 00:15:05,770
Now I'm going to say 40 plus.

228
00:15:05,880 --> 00:15:08,700
So here this is really important here.

229
00:15:08,910 --> 00:15:15,780
It is where we actually find the park and just notice that here I am actually teaching you advanced

230
00:15:16,350 --> 00:15:23,700
debugging in Android so make sure to pay attention to what I'm teaching you because this is very important

231
00:15:23,700 --> 00:15:27,370
and it's going to help you a lot in your future Android projects.

232
00:15:27,570 --> 00:15:32,520
If you are Android If you're actually an Android Developer and don't know how to debug an app you're

233
00:15:32,550 --> 00:15:34,930
going to encounter lots of problems.

234
00:15:34,950 --> 00:15:36,100
Trust me.

235
00:15:36,120 --> 00:15:39,650
So now just up here tension here.

236
00:15:39,900 --> 00:15:43,700
I actually press on the plus operator here.

237
00:15:43,710 --> 00:15:44,340
Right.

238
00:15:44,670 --> 00:15:50,820
So now at the affrightedly Statham if it is called Here we say if the current operator is not equal

239
00:15:50,820 --> 00:15:53,060
to and also the current operator is equal.

240
00:15:53,240 --> 00:15:53,820
OK.

241
00:15:54,000 --> 00:15:56,700
Here you can see the value of the current operator.

242
00:15:56,700 --> 00:15:58,110
So it is not equal to all.

243
00:15:58,140 --> 00:16:06,020
And here it says and the current number is not equal to an empty stream given you.

244
00:16:06,030 --> 00:16:10,810
So it's is true the kind of number is not equal to an empty string value.

245
00:16:10,920 --> 00:16:11,810
Right.

246
00:16:12,370 --> 00:16:23,580
And here I'm going to actually just click on step over so there is something wrong here OK.

247
00:16:23,750 --> 00:16:25,170
There is something wrong here.

248
00:16:26,060 --> 00:16:30,830
The current number is actually no it's not not.

249
00:16:30,860 --> 00:16:36,780
It is actually the value of the kind of number it is an empty string value.

250
00:16:36,780 --> 00:16:41,770
You can see that here canit number is not equal to an empty string value and it is true.

251
00:16:41,790 --> 00:16:46,460
This means the current number is actually empty.

252
00:16:47,210 --> 00:16:54,440
And that's why this statement here didn't execute and it the flow of the program went into the else

253
00:16:54,440 --> 00:16:55,600
statement here.

254
00:16:56,880 --> 00:16:57,590
OK.

255
00:16:58,020 --> 00:16:58,980
So when I pressed on.

256
00:16:58,980 --> 00:17:03,150
So we have the result 30 and I pressed on the plus operator.

257
00:17:03,330 --> 00:17:08,750
Now it wants to execute the SQL statement.

258
00:17:08,800 --> 00:17:14,830
So now if it wants to assign the current number which is actually an interesting value to this three

259
00:17:14,830 --> 00:17:16,450
number I left.

260
00:17:16,450 --> 00:17:21,780
So here you can see that it says that the value of the current number is empty.

261
00:17:21,850 --> 00:17:24,780
It's just showing us the value of the current number.

262
00:17:24,880 --> 00:17:27,950
So this empty value is going to be assigned to the string number.

263
00:17:28,120 --> 00:17:29,950
Let's click on step over.

264
00:17:29,950 --> 00:17:36,310
Now you can see that the value of this thing number at live is actually an empty string value and the

265
00:17:36,310 --> 00:17:41,460
value of the current number is also an empty string value.

266
00:17:41,650 --> 00:17:42,270
Right.

267
00:17:43,440 --> 00:17:47,990
If I actually kind of step over again now the tapped operator is going to be assigned to the current

268
00:17:47,990 --> 00:17:48,760
operator.

269
00:17:48,950 --> 00:17:52,660
So the current operator is going to be Plus the plus operator.

270
00:17:52,700 --> 00:17:58,670
So if I actually kind of step over is going to go on I can see that it's this case a statement between

271
00:17:58,670 --> 00:17:59,980
the plus is executed.

272
00:18:00,200 --> 00:18:05,680
So there is nothing wrong with this line of code so we're going to just resume the program.

273
00:18:06,020 --> 00:18:17,560
So we have 40 plus and not is that now the value of the string number at lift is an empty string value.

274
00:18:17,780 --> 00:18:29,730
And that's where the bug is so if I can for example number five and if I click on these equal operator

275
00:18:30,090 --> 00:18:33,670
here here the app is going to crash.

276
00:18:33,760 --> 00:18:40,240
But because we created a debugging point here a red point we can actually control the flow of the program.

277
00:18:40,240 --> 00:18:44,530
So now I'm going to show you that the app is actually going to crash.

278
00:18:44,840 --> 00:18:52,120
Now you know that we have that kind of operator is plus and the current number is five because I pressed

279
00:18:52,120 --> 00:18:53,350
on the number five here.

280
00:18:53,580 --> 00:18:54,000
OK.

281
00:18:54,070 --> 00:18:55,820
So I'm going to ask you this if statement.

282
00:18:56,110 --> 00:19:00,820
If I click on this here so let me show you that if I actually show you that.

283
00:19:00,850 --> 00:19:01,770
Let's click on this.

284
00:19:01,780 --> 00:19:03,270
Step over.

285
00:19:03,280 --> 00:19:08,140
Now the value of the current number if it is actually number five is going to be assigned to the string

286
00:19:08,140 --> 00:19:08,550
number.

287
00:19:08,580 --> 00:19:15,560
And right so we have number five as the value of the string number.

288
00:19:15,790 --> 00:19:16,700
That's right.

289
00:19:16,960 --> 00:19:23,650
And we're going to execute this kind of number this line of code and an empty string value is going

290
00:19:23,650 --> 00:19:25,670
to be assigned for the current number.

291
00:19:25,990 --> 00:19:27,880
So let's kind of step over.

292
00:19:27,920 --> 00:19:33,520
And now he's going to is a huge statement and the current operator is Plus if I click on this that over

293
00:19:33,520 --> 00:19:33,820
again.

294
00:19:33,820 --> 00:19:40,060
So this case statement here is going to be executed case plus calculations with the assignment operator

295
00:19:40,090 --> 00:19:43,310
integers that parse and string number.

296
00:19:43,350 --> 00:19:45,870
Absolutely if it's.

297
00:19:46,000 --> 00:19:52,240
So if I hover over this string number at length it means it says that the value the current value of

298
00:19:52,240 --> 00:19:56,560
this string number at left is an empty string value.

299
00:19:56,650 --> 00:20:02,020
So we cannot convert an empty string value to an integer value.

300
00:20:02,050 --> 00:20:12,330
So what happens when I click on this tip over our app crashed and if I click on a resume here you can

301
00:20:12,330 --> 00:20:14,850
see that the application crashed.

302
00:20:14,850 --> 00:20:19,210
So we found the park and now we need to solve that part.

303
00:20:19,500 --> 00:20:27,400
So let me close this for let's little into this calculator that will file and here the problem is inside

304
00:20:27,400 --> 00:20:34,690
this line of code this approach to restaffed method we need to create an initial statement for the kind

305
00:20:34,690 --> 00:20:39,360
of number is not equal to gnarl is not equal to empty string value.

306
00:20:39,400 --> 00:20:49,450
So by using an and logical operator at a park actually went inside our application.

307
00:20:49,800 --> 00:20:55,410
So here we need to use an if statement instead of an and and logical operator.

308
00:20:55,620 --> 00:20:56,370
Right.

309
00:20:56,700 --> 00:21:07,550
So here we can go inside each statement and see if current number is not equal to an empty string value.

310
00:21:08,400 --> 00:21:12,930
Then we can open and close this statement by using these curly braces and we can actually delete this

311
00:21:12,930 --> 00:21:15,810
part of this if statement here.

312
00:21:16,080 --> 00:21:18,900
And we don't want to use this as a logical operator.

313
00:21:19,080 --> 00:21:25,320
So here we use an inner ears and in a if statement instead of an ontological operator.

314
00:21:25,350 --> 00:21:30,510
So if we're going to actually delete does anything really break out of this if Karez number is not equal

315
00:21:30,510 --> 00:21:32,660
to interesting value.

316
00:21:33,150 --> 00:21:43,550
And if you're going to put the 88 in curly brace here before dispells a statement here OK.

317
00:21:44,040 --> 00:21:53,850
So now this you can see that now dispells statement here is only related to this current number if current

318
00:21:53,850 --> 00:21:55,540
operator is not equal to.

319
00:21:55,540 --> 00:22:03,390
Now if statement not the inner one does one if the current number is not equal to an empty string value

320
00:22:03,870 --> 00:22:04,660
OK.

321
00:22:04,800 --> 00:22:10,610
So whenever this statement here is kind of operator is not equal to null.

322
00:22:10,640 --> 00:22:17,790
If whenever this condition fails then the else statement here is going to be executed.

323
00:22:18,000 --> 00:22:18,470
OK.

324
00:22:18,570 --> 00:22:25,080
And if this condition here is kind of the number is not equal to an empty string value here if this

325
00:22:25,080 --> 00:22:31,350
condition fails it's not going to execute the else statement because inside the else statement we are

326
00:22:31,350 --> 00:22:36,500
actually assigning an empty string value to the current number.

327
00:22:36,890 --> 00:22:41,590
OK so that's the cause of the error.

328
00:22:41,610 --> 00:22:46,670
So now let me actually delete this a breaking point.

329
00:22:47,980 --> 00:22:48,970
By just clicking on it.

330
00:22:48,970 --> 00:22:57,260
And now if you run the app let me show you the emulator.

331
00:22:57,300 --> 00:23:06,260
So for example we have number five multiplied by free equal to 15 plus free.

332
00:23:06,280 --> 00:23:10,830
Now if I click on is equal here our application is not going to crash.

333
00:23:10,840 --> 00:23:14,260
The result is going to be shown to the user number 18.

334
00:23:14,260 --> 00:23:16,120
Now the error is solved.

335
00:23:16,480 --> 00:23:17,040
OK.

336
00:23:17,050 --> 00:23:17,900
If you want to.

337
00:23:17,980 --> 00:23:23,370
So we can actually also create a breaking point here again for this operator is that.

338
00:23:23,370 --> 00:23:30,650
So let's again click on this debugging here debulking and let me show you the emulator because I want

339
00:23:30,650 --> 00:23:37,250
to show you now the bug is killed and we can actually run the app smoothly and see for example Number

340
00:23:37,280 --> 00:23:41,660
five plus number five plus.

341
00:23:42,070 --> 00:23:47,640
So he had his papped operator is plus and the current operator is null.

342
00:23:47,740 --> 00:23:54,850
So this means that this if this condition here it evaluates to false this condition here fails.

343
00:23:54,850 --> 00:23:56,800
And now it's going to execute the else statement.

344
00:23:56,800 --> 00:23:58,550
If I click on this that over.

345
00:23:58,750 --> 00:24:02,960
So you can see that the card somebody is going to be assigned to district number at left.

346
00:24:03,310 --> 00:24:08,260
And here the current number the value of the currency nobody is going to be emptied.

347
00:24:08,300 --> 00:24:09,370
Right.

348
00:24:09,380 --> 00:24:14,420
So now it's going to assign the taps operator to the current operator.

349
00:24:14,420 --> 00:24:17,350
The operator is Plus So if it is secure the sign of code.

350
00:24:17,420 --> 00:24:19,790
Now the current operator is going to be plus.

351
00:24:19,790 --> 00:24:27,600
So let me resume the app so five plus two equal.

352
00:24:27,820 --> 00:24:33,040
So again the affrightedly Statham's if it is called So now it's going to again execute this brief statement.

353
00:24:33,040 --> 00:24:39,610
So if current operator is not equal to not so now the current operator is the plus OPERATOR OK.

354
00:24:39,790 --> 00:24:42,120
If I click on this it's over.

355
00:24:42,190 --> 00:24:46,430
Now this condition evaluates to true and the current operator is not equal to.

356
00:24:46,450 --> 00:24:52,560
So we have this condition if current number is not equal to an empty string value.

357
00:24:52,560 --> 00:24:57,510
The number is not equal to an empty string value because I pressed on this number two.

358
00:24:57,730 --> 00:25:02,550
So again if I had this condition here evaluates to true and it's not a fake.

359
00:25:02,650 --> 00:25:05,680
So if I click on this is that over.

360
00:25:05,800 --> 00:25:11,360
Now it's going to take you design I've got Charon's number is going to be assigned to this thing number

361
00:25:11,580 --> 00:25:12,250
three right.

362
00:25:12,260 --> 00:25:13,220
Valuable.

363
00:25:13,240 --> 00:25:18,880
So it's this number right 30 is now null the value of this value business is now null but the value

364
00:25:18,880 --> 00:25:20,310
of the current number is two.

365
00:25:20,500 --> 00:25:24,740
So number two is going to be assigned to district number and right variable.

366
00:25:24,820 --> 00:25:30,970
If I step over here you can see the value of this string number that's right to and an empty string

367
00:25:30,970 --> 00:25:33,640
value is going to be assigned to this current number.

368
00:25:33,640 --> 00:25:39,910
So if I click on this step over here now is going to execute the switch statement.

369
00:25:39,910 --> 00:25:45,720
So I pressed on the plus OPERATOR Right the current operator is now a plus.

370
00:25:45,730 --> 00:25:52,780
So if I click on step over so it's going to secure this case plus and it's going to just add the value

371
00:25:52,780 --> 00:25:54,590
of the string number at left.

372
00:25:54,760 --> 00:26:00,100
So you can see the value of this number at a fixed number of Y to the value of the street number and

373
00:26:00,250 --> 00:26:02,380
right which is number two.

374
00:26:02,620 --> 00:26:08,440
So the result is going to be assigned to the calculation result and it's going to actually execute this

375
00:26:08,440 --> 00:26:09,580
line of code here.

376
00:26:09,760 --> 00:26:14,740
So number ASLEF assignment operators think that the value of calculation is result the value of the

377
00:26:14,740 --> 00:26:16,170
calculation result is numbers.

378
00:26:16,180 --> 00:26:23,240
And so number seven is going to be assigned to the string number and left and execute this line of code.

379
00:26:23,740 --> 00:26:26,560
And it is going out with this value to the screen.

380
00:26:26,590 --> 00:26:32,470
So now it's going to execute this line of code that taps operator is going to be assigned to the current

381
00:26:32,470 --> 00:26:33,520
operator.

382
00:26:33,560 --> 00:26:36,260
The operator is the equal operator.

383
00:26:36,610 --> 00:26:38,300
So now it's going to.

384
00:26:38,460 --> 00:26:40,360
It's going to be assigned to the current operator.

385
00:26:40,380 --> 00:26:49,410
If we execute this line of code so it is the current operator is equal let's resume the app.

386
00:26:49,420 --> 00:26:51,460
So now you can see number seven here.

387
00:26:51,460 --> 00:26:53,260
So now you have the number seven.

388
00:26:53,290 --> 00:26:56,220
Number seven multiply it.

389
00:26:56,260 --> 00:26:58,890
I just click on clicked on the multiplied operator.

390
00:26:59,080 --> 00:27:01,310
So it is current operator is not equal to.

391
00:27:01,320 --> 00:27:04,460
So it's not because the current operator is an equal operator.

392
00:27:04,660 --> 00:27:07,960
So let's say this line of code now is going to execute this line.

393
00:27:08,010 --> 00:27:17,070
But if current number is not equal to an empty string value it is to cut the value of the current number

394
00:27:17,080 --> 00:27:19,090
is actually an empty string value.

395
00:27:19,120 --> 00:27:20,590
So there is something wrong here.

396
00:27:20,680 --> 00:27:23,350
This condition here is going to be failed.

397
00:27:23,500 --> 00:27:31,560
If I execute this line of code now we can see that the statement here didn't execute because if it would

398
00:27:31,710 --> 00:27:38,560
if the else statement did execute the empty string value of the current operator is going to be assigned

399
00:27:38,560 --> 00:27:44,150
to this number that live and that's where the actual park would occur.

400
00:27:44,590 --> 00:27:51,520
Now you can see that because these statements now didn't actually secured it's going to assign the trapped

401
00:27:51,610 --> 00:27:57,450
operator to the current operator that have the approach top multiply OK.

402
00:27:57,950 --> 00:28:04,640
I said that 7 multiplied the top of Rotary's multiply and the tapped operator is going to be assigned

403
00:28:04,640 --> 00:28:06,050
to the current operator.

404
00:28:06,050 --> 00:28:15,150
So if I can step over now we can see the current operators multiply so let's resume the 7 multiply by

405
00:28:15,960 --> 00:28:17,010
2.

406
00:28:17,370 --> 00:28:19,970
If you click on these are equal operator here.

407
00:28:19,980 --> 00:28:25,890
Now again it's going to check this condition if current operator is not equal to not it's not the value

408
00:28:25,890 --> 00:28:28,070
of the current operator is multiply.

409
00:28:28,320 --> 00:28:28,920
OK.

410
00:28:29,120 --> 00:28:36,480
So that over and here it is if current number is not equal to an empty string value it's not because

411
00:28:36,570 --> 00:28:39,000
now the value of that number is number two.

412
00:28:39,000 --> 00:28:42,330
I clicked on the number two I and this number two.

413
00:28:42,360 --> 00:28:45,880
So the value of that kind of number is to step over.

414
00:28:46,200 --> 00:28:49,740
And here it says current number is going to be assigned to the string number.

415
00:28:49,830 --> 00:28:50,190
Right.

416
00:28:50,190 --> 00:28:54,690
So number two is going to be assigned to this variable string number that's right and the value of the

417
00:28:54,690 --> 00:28:56,350
kind of number is going to be emptied.

418
00:28:56,670 --> 00:29:01,320
And so each kind of operator which is going to be a multiplication operator and it's going to stick

419
00:29:01,320 --> 00:29:09,050
with this line of code the string number at left is seven and string number that's right is number two.

420
00:29:09,050 --> 00:29:12,460
The result is going to be assigned to the calculation result number 14.

421
00:29:12,650 --> 00:29:18,880
So here is going to as I assign the number 14 to this string number at live step over.

422
00:29:19,040 --> 00:29:21,900
And the value is going to be outfitted to the screen.

423
00:29:22,310 --> 00:29:29,640
So now the trapped operator which is actually the equal operator is now going to be assigned to this

424
00:29:29,660 --> 00:29:31,480
current operator.

425
00:29:31,510 --> 00:29:33,620
So is that over.

426
00:29:33,670 --> 00:29:35,790
And now if I step over again.

427
00:29:35,790 --> 00:29:37,720
So let's resume resumed.

428
00:29:37,740 --> 00:29:38,730
And now we can see.

429
00:29:38,730 --> 00:29:44,280
Let me show you the emulator so you can see that number 14 is output to the screen and our application

430
00:29:44,280 --> 00:29:45,100
didn't crash.

431
00:29:45,120 --> 00:29:46,610
So I can number 14.

432
00:29:46,890 --> 00:29:55,830
So let me just with this breaking point aren't in order to show you that the bug is actually killed

433
00:29:55,880 --> 00:29:58,670
and we can run the app smoothly without any error.

434
00:29:58,670 --> 00:30:14,640
So five minus three equal number two four so multiplied by nine equals 18 divided by three equal six.

435
00:30:14,660 --> 00:30:17,260
So you can see that that application works fine.

436
00:30:17,460 --> 00:30:17,970
OK.

437
00:30:18,290 --> 00:30:20,360
So that's enough for this tutorial.

438
00:30:20,450 --> 00:30:26,090
And in the next story we're going to work on this clear pattern so that they never spot it is actually

439
00:30:26,120 --> 00:30:32,930
tapped or clicked everything on the screen of this for example the text results that Tastee calculations

440
00:30:32,960 --> 00:30:38,540
everything should be clear and the user and the user can actually start calculating from New.

441
00:30:38,540 --> 00:30:40,280
So thank you very much for watching.

442
00:30:40,310 --> 00:30:44,960
If you have any questions please support the discussion in the course and then I will do my best to

443
00:30:44,960 --> 00:30:46,300
answer all of your questions.

444
00:30:46,490 --> 00:30:48,340
I'll see you in the next tutorial.

