1
00:00:00,350 --> 00:00:10,620
This sexual comments out this statement here and these are ending curly brace of this statement and

2
00:00:11,070 --> 00:00:18,990
so and we could actually put this for statement put this for a loop outside of this enclave.

3
00:00:19,020 --> 00:00:19,680
OK.

4
00:00:20,010 --> 00:00:27,470
And inside of the uncreate effort so that the execution of this for loop would happen only once.

5
00:00:27,570 --> 00:00:28,040
OK.

6
00:00:28,140 --> 00:00:36,270
So let's actually copy this for a loop here and let's actually put it here out after these students

7
00:00:36,270 --> 00:00:37,630
reviews re.

8
00:00:38,270 --> 00:00:39,030
OK.

9
00:00:39,420 --> 00:00:47,030
And then let's actually comment out the for loop here inside of this comfort Comerford OK.

10
00:00:47,400 --> 00:00:53,400
And this uncreate my fate is going to be actually executed only when the application is actually run

11
00:00:53,430 --> 00:01:00,220
by the user when the user actually touches the icon of the application in his or her phone.

12
00:01:00,450 --> 00:01:03,530
And then our application starts in that time.

13
00:01:03,540 --> 00:01:05,960
These are uncreate me if it is going to be executed.

14
00:01:05,970 --> 00:01:06,850
OK.

15
00:01:06,990 --> 00:01:13,430
So let's actually create a toast in order to show you that when this effort is going to be caught our

16
00:01:13,440 --> 00:01:18,610
toast is actually a way in order to actually show a message to the user.

17
00:01:18,670 --> 00:01:21,470
OK I talk more about hosta later in this course.

18
00:01:21,570 --> 00:01:27,000
But for now remember this is this is actually our way in order to show and to show a message to the

19
00:01:27,000 --> 00:01:27,660
user.

20
00:01:27,750 --> 00:01:35,150
So here inside of this uncreate Meffert here for example I can just type in toast that make text.

21
00:01:35,580 --> 00:01:40,580
So here we need to actually specify our free argument.

22
00:01:40,590 --> 00:01:41,160
OK.

23
00:01:41,160 --> 00:01:45,430
So for the first argument just type in here is come on.

24
00:01:45,870 --> 00:01:50,200
And here we need to actually specify the text that I want to show you to the user.

25
00:01:50,310 --> 00:01:57,300
So here I just put into double quotes as you can see here the type of these are valuable is Chad sequence.

26
00:01:57,420 --> 00:02:03,770
So if we could just put into double quotes and here I can just typing uncreate Mefford is caught.

27
00:02:03,900 --> 00:02:04,560
OK.

28
00:02:04,770 --> 00:02:08,780
Comma and here we need to actually specify the duration of this message.

29
00:02:08,940 --> 00:02:13,310
So here I can just type in toast that line long.

30
00:02:14,010 --> 00:02:23,160
OK here after the ending of round in Brachet of this Mefford I could just type in that show.

31
00:02:23,890 --> 00:02:24,500
OK.

32
00:02:24,840 --> 00:02:27,900
Here I called the show Smurfette and this tossed here.

33
00:02:27,900 --> 00:02:28,550
OK.

34
00:02:28,890 --> 00:02:32,160
And let's actually do it on our project and see what happens.

35
00:02:32,160 --> 00:02:36,680
So now let's actually run our project and see what happens.

36
00:02:37,680 --> 00:02:40,350
As you can see here now we can see this Meffert.

37
00:02:40,350 --> 00:02:45,600
This message here uncreate Meffert is called Let's actually click on the spot in here as you can see

38
00:02:45,600 --> 00:02:45,860
here.

39
00:02:45,870 --> 00:02:47,630
We put this for a loop here.

40
00:02:47,640 --> 00:02:52,580
Inside of this uncreate my faith and after that for a loop I actually called this that unclick lesson

41
00:02:52,580 --> 00:02:55,480
and my friend on the spitting results OK.

42
00:02:55,500 --> 00:03:00,230
And here we are actually putting these lines of code in order to show all of these values to the screen.

43
00:03:00,360 --> 00:03:03,270
So let's actually click on the spot and let's see what happens.

44
00:03:03,390 --> 00:03:05,940
As you can see if you can see these values here.

45
00:03:06,120 --> 00:03:12,210
And let's actually click on this button again as you can see here these values don't change any more

46
00:03:12,210 --> 00:03:12,510
here.

47
00:03:12,510 --> 00:03:13,030
OK.

48
00:03:13,230 --> 00:03:16,050
This for loop is going to be executed only once.

49
00:03:16,170 --> 00:03:16,800
OK.

50
00:03:17,070 --> 00:03:21,240
And then inside of this are certain calculus and an Mefford in say that his uncle.

51
00:03:21,250 --> 00:03:22,680
I'm afraid we can't see.

52
00:03:22,680 --> 00:03:29,430
We just tried to output these values the values that are actually inside of these of variables to the

53
00:03:29,430 --> 00:03:29,820
screen.

54
00:03:29,820 --> 00:03:30,360
OK.

55
00:03:30,570 --> 00:03:32,030
So hopefully that makes sense.

56
00:03:32,040 --> 00:03:38,340
Let's actually comment out this for a loop here because I want to show you another way in order to actually

57
00:03:38,490 --> 00:03:40,070
write your codes.

58
00:03:40,190 --> 00:03:40,760
OK.

59
00:03:40,920 --> 00:03:47,880
I want to show you to use actually switch instead of if statements in order to actually specify the

60
00:03:47,880 --> 00:03:51,330
correct values and outputs those values to the screen.

61
00:03:51,330 --> 00:03:51,830
OK.

62
00:03:52,290 --> 00:03:55,410
So here as you can see we commented out this for a loop here.

63
00:03:55,560 --> 00:03:57,970
Let's actually uncomment this for a loop.

64
00:03:58,260 --> 00:03:58,790
OK.

65
00:03:58,920 --> 00:04:02,540
And now let's actually uncommented this statement.

66
00:04:02,550 --> 00:04:05,040
This is a first time statement here.

67
00:04:05,490 --> 00:04:06,630
OK.

68
00:04:07,140 --> 00:04:10,820
I think this is the best solution for this problem.

69
00:04:11,280 --> 00:04:12,350
OK.

70
00:04:13,020 --> 00:04:18,720
And uncomment this first time valuable here as you can see we assign the value of false to the first

71
00:04:18,720 --> 00:04:19,230
time.

72
00:04:19,230 --> 00:04:24,810
And here uncomment the end in curly brace as you can see here of this statement.

73
00:04:26,750 --> 00:04:32,260
So now let's actually comment out these of these statements here OK.

74
00:04:33,780 --> 00:04:40,230
As you can see here now I want to actually use the switch statement in order to actually specify the

75
00:04:40,230 --> 00:04:43,260
correct values and output those values to the screen.

76
00:04:43,260 --> 00:04:43,740
OK.

77
00:04:44,010 --> 00:04:46,260
So here again just typing sweet.

78
00:04:46,880 --> 00:04:47,370
OK.

79
00:04:47,510 --> 00:04:55,230
And inside the apprentice's I can just type in student reviews brackets and inside the branch brackets

80
00:04:55,260 --> 00:04:59,230
I can just refer to the name of the index variable.

81
00:04:59,730 --> 00:05:05,120
And here I can just open and close my switch statement by using these curly braces.

82
00:05:05,310 --> 00:05:12,020
So instead of the switch statement as you can see here I can just type in chase.

83
00:05:12,760 --> 00:05:13,420
OK.

84
00:05:13,740 --> 00:05:17,050
Case 5 colon.

85
00:05:17,540 --> 00:05:18,240
OK.

86
00:05:18,840 --> 00:05:23,110
Plus plus five stars leave review.

87
00:05:23,100 --> 00:05:23,940
OK.

88
00:05:24,400 --> 00:05:26,200
Semi-colon break.

89
00:05:26,970 --> 00:05:34,170
And here what I am saying is switch between the values of these students to use some index.

90
00:05:34,200 --> 00:05:34,540
OK.

91
00:05:34,560 --> 00:05:40,860
So for example for the first time that this loop is going to be executed the value of this index variable

92
00:05:40,860 --> 00:05:41,810
is zero.

93
00:05:41,940 --> 00:05:44,020
And here is when I try to check this condition.

94
00:05:44,190 --> 00:05:49,800
So 0 is less than the value of the length of this student reviews array.

95
00:05:49,950 --> 00:05:50,630
OK.

96
00:05:51,150 --> 00:05:56,880
So you can actually go inside of this for a loop and then it can actually execute this switch statement.

97
00:05:57,180 --> 00:06:03,540
So here we are saying that switch between the values of these students revues sub index.

98
00:06:03,540 --> 00:06:06,780
So the value of the index for the first time is zero.

99
00:06:06,780 --> 00:06:07,280
OK.

100
00:06:07,440 --> 00:06:14,310
So student reviews sub zero as you can see here that this means that the value that is inside of the

101
00:06:14,310 --> 00:06:16,790
index 0 is for example.

102
00:06:16,800 --> 00:06:18,980
As you can see here five number five.

103
00:06:19,020 --> 00:06:19,830
OK.

104
00:06:20,310 --> 00:06:27,030
So as you can see here inside of the switch statement I'm saying in that case it means that in case

105
00:06:27,180 --> 00:06:32,250
the value that is inside of the index zero of this array is number five which it is.

106
00:06:32,280 --> 00:06:33,980
As you can see the value is.

107
00:06:33,990 --> 00:06:43,170
Number five ok then increment the value of these 5 stars of The View valuable by one and then return

108
00:06:43,170 --> 00:06:44,010
that value to me.

109
00:06:44,010 --> 00:06:44,690
OK.

110
00:06:45,030 --> 00:06:47,890
And that break out of this switch statement.

111
00:06:48,270 --> 00:06:48,760
OK.

112
00:06:48,810 --> 00:07:04,440
So here again I can just type in case four plus plus false starts review semi-colon rage case free plus

113
00:07:04,440 --> 00:07:07,880
plus free review.

114
00:07:09,570 --> 00:07:27,570
Break case two colon plus plus two starts review semicolon break case 1 colon plus plus one star review

115
00:07:28,740 --> 00:07:30,900
semicolon break.

116
00:07:31,580 --> 00:07:32,560
OK.

117
00:07:33,510 --> 00:07:39,720
So now the result of this switch statement is actually the same as the result of this if statements

118
00:07:39,720 --> 00:07:41,310
that you actually created here.

119
00:07:41,340 --> 00:07:46,890
OK so now let's actually run our project again and let's see what happens.

120
00:07:46,890 --> 00:07:51,520
So as you can see here our application is actually running on the emulator.

121
00:07:51,630 --> 00:07:53,040
So let's actually click on this.

122
00:07:53,040 --> 00:07:57,770
Show me the results button as you can see we can see these values again here.

123
00:07:57,810 --> 00:07:58,430
OK.

124
00:07:58,620 --> 00:08:02,700
So let's actually click on this button again as you can see these values don't change.

125
00:08:02,730 --> 00:08:04,500
Our application is actually working right.

126
00:08:04,500 --> 00:08:05,200
OK.

127
00:08:05,760 --> 00:08:09,630
So hopefully that makes sense and I think that's enough for this tutorial.

128
00:08:09,690 --> 00:08:14,820
If you have any questions please post the discussion in the course and I'll do my best to answer all

129
00:08:14,820 --> 00:08:15,980
of your questions.

130
00:08:16,110 --> 00:08:20,260
Thank you very much for watching and I'll see you in the next tutorial.

