1
00:00:00,240 --> 00:00:07,470
So if actually putting a value here for example Number 20 Let's see what happens and then click on this.

2
00:00:07,470 --> 00:00:09,210
Show me the results button here.

3
00:00:09,240 --> 00:00:15,120
So as you can see here it says The value is not 51 and the value is 20.

4
00:00:15,350 --> 00:00:15,960
OK.

5
00:00:15,960 --> 00:00:22,890
So let's actually change these value to another value for example number 51 and then click on this.

6
00:00:22,890 --> 00:00:24,500
Show me the results button here.

7
00:00:24,540 --> 00:00:25,770
So it says 51.

8
00:00:25,770 --> 00:00:26,750
Great.

9
00:00:26,760 --> 00:00:29,940
So it did actually execute these lines of code here.

10
00:00:29,940 --> 00:00:30,450
OK.

11
00:00:30,600 --> 00:00:37,170
So if the value of these are textfield value actually contains this number it's going to actually execute

12
00:00:37,170 --> 00:00:38,100
this line of code here.

13
00:00:38,100 --> 00:00:38,550
OK.

14
00:00:38,700 --> 00:00:40,820
Textfield plus great.

15
00:00:40,840 --> 00:00:42,790
So 51 spacecraft.

16
00:00:43,080 --> 00:00:50,820
And if the value of these are textfield here actually doesn't contain this number here and it it may

17
00:00:50,820 --> 00:00:53,410
contain actually other values or any value.

18
00:00:53,580 --> 00:00:57,700
It's going to actually execute this line of code inside of these else statement here.

19
00:00:57,720 --> 00:00:58,450
OK.

20
00:00:58,650 --> 00:01:04,420
If textfield value that contains 51 is going to execute this line of code here.

21
00:01:04,680 --> 00:01:08,340
But illis and this means anything else.

22
00:01:08,340 --> 00:01:08,750
OK.

23
00:01:08,880 --> 00:01:15,240
If anything else happens if we actually putting any value here it's going to actually execute this line

24
00:01:15,240 --> 00:01:15,830
of code.

25
00:01:16,020 --> 00:01:16,540
OK.

26
00:01:16,710 --> 00:01:23,910
So let's actually delete this 51 and we can actually put in another value for example number 80 and

27
00:01:24,390 --> 00:01:30,860
click on this show me there is at the bottom here and it says The value is not 51 and the value is 80.

28
00:01:31,010 --> 00:01:31,690
OK.

29
00:01:31,710 --> 00:01:33,220
So hopefully that makes sense.

30
00:01:33,330 --> 00:01:37,870
OK so now let's actually go back inside this main activity class here.

31
00:01:38,160 --> 00:01:44,880
And let's actually as you can see here we've got some duplicated Kautsky or KTXA result set text and

32
00:01:44,930 --> 00:01:46,890
TXI the result that said text.

33
00:01:46,890 --> 00:01:47,430
OK.

34
00:01:47,700 --> 00:01:56,170
So we can actually create only one line of code that actually says X degrees and that set text OK.

35
00:01:56,250 --> 00:01:59,030
So there is a solution for this problem here OK.

36
00:01:59,100 --> 00:02:04,020
I don't like actually producing duplicated code in in my program.

37
00:02:04,080 --> 00:02:04,550
OK.

38
00:02:04,680 --> 00:02:07,950
Because that may actually result in bugs.

39
00:02:07,950 --> 00:02:15,100
So in order to solve this problem we can actually create a strange object here named result.

40
00:02:15,620 --> 00:02:16,110
OK.

41
00:02:16,230 --> 00:02:20,920
And then we need to actually assign a value to these valuable here.

42
00:02:20,940 --> 00:02:21,550
OK.

43
00:02:21,680 --> 00:02:23,450
Or an empty variable is enough.

44
00:02:23,550 --> 00:02:24,140
OK.

45
00:02:24,480 --> 00:02:27,810
If you want to you can actually not to assign any value to this variable.

46
00:02:28,020 --> 00:02:32,240
And here we can actually comment out these lines of code here.

47
00:02:32,760 --> 00:02:33,110
OK.

48
00:02:33,120 --> 00:02:41,550
Because I want to show you an important point here and now I can actually assign these values to this

49
00:02:41,870 --> 00:02:42,990
string object here.

50
00:02:42,990 --> 00:02:45,530
OK so I can't just type in here result.

51
00:02:45,820 --> 00:02:53,270
Assignment operator and then I can actually refer to the name of this textfield value object plus.

52
00:02:53,280 --> 00:02:55,980
And then I can actually put into double quotes space.

53
00:02:56,190 --> 00:02:57,280
Great.

54
00:02:57,960 --> 00:02:58,440
OK.

55
00:02:58,440 --> 00:03:05,710
And here again I can actually refer to the name of this result variable result assignment operator.

56
00:03:05,910 --> 00:03:10,130
And then I can actually assign this value to my result variable.

57
00:03:10,140 --> 00:03:10,610
OK.

58
00:03:10,620 --> 00:03:16,680
So as you can see here this result valuable is actually a local variable OK a local variable is a value

59
00:03:16,700 --> 00:03:19,360
but that is actually declared inside of the method.

60
00:03:19,440 --> 00:03:29,700
OK so now as you can see after this if else statement here I can just type in here X the result that

61
00:03:30,120 --> 00:03:37,320
said text and then inside Apprentice's I can just refer to the name of this resolved value.

62
00:03:37,410 --> 00:03:41,250
OK so now let's actually run our project and see what happens.

63
00:03:41,250 --> 00:03:48,420
So now as you can see here I can actually enter a number here for example number 27 and if I click on

64
00:03:48,420 --> 00:03:56,550
the spot in here show me the result as you can see it says the value is not 51 and the value is 27.

65
00:03:56,580 --> 00:03:58,690
So now let's actually did it this value here.

66
00:03:58,710 --> 00:04:04,020
And let's actually put the number 51 here and it says again 51.

67
00:04:04,020 --> 00:04:05,020
Great.

68
00:04:05,070 --> 00:04:05,730
OK.

69
00:04:05,730 --> 00:04:11,280
So as you can see here in this way all our codes are actually more maintainable.

70
00:04:11,280 --> 00:04:13,200
This is a very professional way.

71
00:04:13,380 --> 00:04:15,020
In order to write your code here.

72
00:04:15,090 --> 00:04:15,490
OK.

73
00:04:15,570 --> 00:04:19,260
So now let me actually comment out this if else statement here.

74
00:04:19,350 --> 00:04:22,680
And now let me actually create another if else statements.

75
00:04:22,710 --> 00:04:29,610
So if and then inside the prentices I can actually specify an expression that actually results in a

76
00:04:29,640 --> 00:04:32,410
true all of or a false value.

77
00:04:32,700 --> 00:04:34,100
So I can just type in here.

78
00:04:34,260 --> 00:04:40,980
Textfield value that as you can see here we can actually call D.

79
00:04:41,010 --> 00:04:43,550
All of these methods on our object here.

80
00:04:43,550 --> 00:04:43,940
OK.

81
00:04:43,980 --> 00:04:45,110
So as you can see here Chad.

82
00:04:45,120 --> 00:04:46,620
At what point add.

83
00:04:46,890 --> 00:04:48,400
And lots of other methods.

84
00:04:48,420 --> 00:04:49,130
OK.

85
00:04:49,440 --> 00:04:57,150
So here I can't I just want to actually use that contains Meffert contains and in say the apprentice's.

86
00:04:57,340 --> 00:04:59,850
I can just put in a value for example.

87
00:05:00,330 --> 00:05:02,480
Number 90.

88
00:05:02,580 --> 00:05:03,240
OK.

89
00:05:03,480 --> 00:05:09,270
And then I need to actually open and close my statement by using these curly braces.

90
00:05:09,300 --> 00:05:16,460
So here I am saying that if the value of these textfield value object actually contains number of any

91
00:05:16,560 --> 00:05:23,430
number 90 I want to actually assign a value to this result local variable.

92
00:05:23,430 --> 00:05:24,510
I think as you can see here.

93
00:05:24,510 --> 00:05:25,020
OK.

94
00:05:25,230 --> 00:05:26,260
So result.

95
00:05:26,550 --> 00:05:34,250
And then inside double quotes and just putting in your grade is a.

96
00:05:34,660 --> 00:05:42,120
OK you're great is eight and your number is.

97
00:05:42,680 --> 00:05:48,040
For example I can actually refer to the name of this textfield value here.

98
00:05:48,080 --> 00:05:48,700
OK.

99
00:05:49,100 --> 00:05:52,440
And then I can actually put a semi-colon at the end of my statement.

100
00:05:52,760 --> 00:06:00,220
So now at the end of this statement here I can just type in Ellis if and as you can see here I am actually

101
00:06:00,240 --> 00:06:02,870
using an if statement here this thing.

102
00:06:02,930 --> 00:06:03,510
OK.

103
00:06:03,800 --> 00:06:10,160
So here I am actually specifying that if the value of these takes feel valued doesn't contain the number

104
00:06:10,170 --> 00:06:17,330
90 and it does contain other value for example it may actually contain number 80.

105
00:06:17,330 --> 00:06:19,250
OK that contains.

106
00:06:19,250 --> 00:06:21,840
And then here I can actually specify number 80.

107
00:06:22,430 --> 00:06:28,620
And this time I want to actually assign another value to this result local variable.

108
00:06:28,640 --> 00:06:29,080
OK.

109
00:06:29,150 --> 00:06:35,680
So inside the double calls I can just type in your grade is B and your number is textfield value.

110
00:06:36,860 --> 00:06:43,390
And here I can actually create another LC statement here and then inside the.

111
00:06:43,730 --> 00:06:50,750
I can just refer to the name of this text field text field value that contains and that in say the prentices

112
00:06:50,780 --> 00:06:57,760
I can actually specify that the value of these textfield value may contain number 70.

113
00:06:58,010 --> 00:07:03,630
So I can actually open and close this elusive statement here by using these curly braces.

114
00:07:03,830 --> 00:07:09,380
And then I can actually assign another value to this result local variable.

115
00:07:09,530 --> 00:07:22,400
So I can't just type in your grade is c and your number is textfield value.

116
00:07:22,660 --> 00:07:27,260
OK and now again I can actually create another LCF statement here.

117
00:07:27,380 --> 00:07:32,190
I can actually create unlimited numbers of LCF statements that I want.

118
00:07:32,380 --> 00:07:32,920
OK.

119
00:07:33,140 --> 00:07:39,880
So elusive textfield value that contains number 60.

120
00:07:40,440 --> 00:07:41,010
OK.

121
00:07:41,240 --> 00:07:46,640
So here I can just assign another value with this result variable.

122
00:07:46,640 --> 00:07:54,320
So I can just type in your grade is F and

123
00:07:57,070 --> 00:08:02,590
number is textfield value.

124
00:08:02,760 --> 00:08:03,410
OK.

125
00:08:03,730 --> 00:08:12,370
And now I can actually create an statement here in order to actually specify that if the value of this

126
00:08:12,370 --> 00:08:17,380
text we are right you object doesn't actually contain any of any of these numbers.

127
00:08:17,380 --> 00:08:20,010
1980 76 the.

128
00:08:20,200 --> 00:08:23,980
I can actually specify that the value of this is aren't malleable is.

129
00:08:24,010 --> 00:08:33,680
For example you are not sufficient so hopefully that makes sense.

130
00:08:33,910 --> 00:08:37,460
And let's actually run our project and see what happens.

131
00:08:37,460 --> 00:08:42,090
So now as you can see here our application is actually running on the emulator.

132
00:08:42,320 --> 00:08:49,310
And now for example if I were to enter the value 90 here inside this textfield and if I click on the

133
00:08:49,310 --> 00:08:51,660
spot in here let's see what happens.

134
00:08:51,740 --> 00:08:56,150
Now it says your grade is a and your number is 90 right.

135
00:08:56,150 --> 00:09:01,850
So as you can see here in this code we created an if statement and it says if these tapes fill here

136
00:09:01,880 --> 00:09:07,540
textfield value as you can see here that contains number 90 as you can see here.

137
00:09:07,680 --> 00:09:10,580
Right then we're going to assign the value.

138
00:09:10,790 --> 00:09:13,790
We are going to actually assign a value to the result variable.

139
00:09:13,800 --> 00:09:14,110
Right.

140
00:09:14,120 --> 00:09:16,260
Which is of types 3 as you can see here.

141
00:09:16,300 --> 00:09:21,310
So result assignment operator and then here we are inside the double quotes.

142
00:09:21,320 --> 00:09:22,750
We actually put this value.

143
00:09:22,790 --> 00:09:29,740
Your grade is a and your number is as you can see here your grade is a and your number is Plus textfield

144
00:09:29,780 --> 00:09:30,170
value.

145
00:09:30,170 --> 00:09:33,050
So here we are actually getting the value of this text field.

146
00:09:33,080 --> 00:09:34,550
90 right.

147
00:09:36,850 --> 00:09:41,100
And for example as you can see we actually created another elusive statement.

148
00:09:41,100 --> 00:09:46,530
And here we are saying that else it takes real value that contains number 80 then it's going to actually

149
00:09:46,560 --> 00:09:48,960
assign this value as you can see here to this result.

150
00:09:48,990 --> 00:09:52,620
So your grade is B and your number is takes with value.

151
00:09:52,620 --> 00:09:57,980
So now let's actually change this value to number 80 and click on this button here.

152
00:09:57,990 --> 00:10:02,260
Now it says your grade is B and your number is 80 right.

153
00:10:02,650 --> 00:10:06,900
And now as you can see here we are checking these are conditions here right.

154
00:10:06,900 --> 00:10:10,140
For example number 90 80 76.

155
00:10:10,280 --> 00:10:16,500
So let's actually put an order number for example number 85 and let's click on this button here.

156
00:10:16,590 --> 00:10:18,560
Now it says you are not sufficient.

157
00:10:18,570 --> 00:10:25,230
So now we actually created an else statement here and here we are saying that if these other conditions

158
00:10:25,260 --> 00:10:29,580
above are not true then it's going to actually execute this statement.

159
00:10:29,610 --> 00:10:35,160
So because we actually entered a value that we didn't actually check in say these if else statements

160
00:10:35,160 --> 00:10:43,890
here as you can see we only checked for number 90 80 70 60 right and we didn't actually create actually

161
00:10:43,890 --> 00:10:46,320
a control statement for number 85.

162
00:10:46,350 --> 00:10:46,980
Right.

163
00:10:46,980 --> 00:10:49,990
So in that case it's going to execute this statement.

164
00:10:50,190 --> 00:10:56,970
So this was a statement he had means that he's going to execute this statement if the conditions above

165
00:10:57,120 --> 00:10:58,040
is not true.

166
00:10:58,170 --> 00:10:58,410
OK.

167
00:10:58,410 --> 00:11:00,680
If the conditions above are not true so.

168
00:11:00,710 --> 00:11:05,520
Else and it's going to go inside the curly braces of this statement and it's going to assign this value

169
00:11:05,540 --> 00:11:10,490
you are not sufficient to this result and it's going as you can see here we are saying that he likes

170
00:11:10,520 --> 00:11:11,430
the result.

171
00:11:11,450 --> 00:11:13,040
That's the Tillich's result.

172
00:11:13,140 --> 00:11:13,820
Right.

173
00:11:14,120 --> 00:11:17,310
And now as you can see it says you are not sufficient.

174
00:11:17,640 --> 00:11:22,890
So hopefully that makes sense and if you have any questions about these if statements please post the

175
00:11:22,890 --> 00:11:26,880
discussion in the course and then I'll do my best to answer all of your questions.

