1
00:00:01,210 --> 00:00:08,830
In this lecture with a great script which will give to use it has the possibility to reject their inputs.

2
00:00:09,150 --> 00:00:15,820
So great script called in a stage star David siobhán.

3
00:00:20,690 --> 00:00:36,200
And on the next line right common I read data from users and make them option to recheck it for data

4
00:00:36,860 --> 00:00:45,130
if data if maybe if provided data are correct

5
00:00:48,980 --> 00:00:54,140
so we can now start gathering some data.

6
00:00:54,300 --> 00:01:02,930
We can ask the user for name so equal and our name

7
00:01:07,200 --> 00:01:18,840
and read user input into a variable called name then we will ask for age and your age and we will read

8
00:01:18,840 --> 00:01:21,670
it into the age.

9
00:01:22,770 --> 00:01:25,800
And then we ask also for the department

10
00:01:29,190 --> 00:01:32,500
and thirdly are the.

11
00:01:33,780 --> 00:01:41,150
Now we can bring to users some summary of what they typed so we can write.

12
00:01:41,640 --> 00:01:43,110
You have and following

13
00:01:56,070 --> 00:02:05,650
so on the next line the bright name followed by output of the whatever name and the same.

14
00:02:05,650 --> 00:02:14,960
We will do for h h followed by output of variable h and the same also for department

15
00:02:17,980 --> 00:02:19,290
or I.

16
00:02:19,290 --> 00:02:22,980
I forgot to read the department of Grabow.

17
00:02:23,380 --> 00:02:30,770
So I will print that variable and I will read it on proper place.

18
00:02:30,940 --> 00:02:33,430
After asking the users department

19
00:02:38,760 --> 00:02:40,980
I can now structure the summary output

20
00:02:44,440 --> 00:02:47,110
and what to do next.

21
00:02:47,110 --> 00:02:49,990
We have displayed to users dead imports.

22
00:02:50,050 --> 00:02:56,230
Now we need to ask them if they agree with data they have entered.

23
00:02:56,680 --> 00:02:57,830
So right.

24
00:02:58,100 --> 00:03:00,420
Is that correct.

25
00:03:00,670 --> 00:03:06,150
And to suggest yes or no possibility is that correct.

26
00:03:11,240 --> 00:03:18,560
Then it does answer into a variable called answer surprisingly.

27
00:03:20,510 --> 00:03:23,940
And now it's time for using a gay structure.

28
00:03:23,960 --> 00:03:32,930
So depending of what ANS-Forth user has chosen that means yes represented by y character are not represented

29
00:03:32,930 --> 00:03:34,670
by any character.

30
00:03:34,670 --> 00:03:42,670
So depending on these Bouvard decide what should happen now we will start with K structures so right

31
00:03:42,690 --> 00:03:49,230
case followed by variable for fall by keyboard in.

32
00:03:49,820 --> 00:03:58,370
So if that variable answer is equals to y in uppercase or which is represented as pipe or it is equal

33
00:03:58,820 --> 00:04:06,900
to y in lowercase we perform some bloke of commands.

34
00:04:07,430 --> 00:04:14,820
Please remember that if you want to run some book of commands for more than one of those as in our case

35
00:04:14,820 --> 00:04:20,630
for uppercase and lowercase VI we don't need to create two or more blocks.

36
00:04:20,790 --> 00:04:28,860
We are herradura using pipe which represents or so if variable bounds for is equal to uppercase of II

37
00:04:28,920 --> 00:04:36,390
or lowercase Why then do the same block of commands for them.

38
00:04:36,390 --> 00:04:42,000
Also don't forget that you need to close the value optional using cried button.

39
00:04:42,340 --> 00:04:52,380
Then if a user has entered why we will save to some file users data so maybe it would be better to just

40
00:04:52,440 --> 00:04:55,590
copy block of code we have already created.

41
00:05:02,510 --> 00:05:06,920
And directed to a file impled not to text.

42
00:05:06,920 --> 00:05:26,410
For example.

43
00:05:26,730 --> 00:05:33,840
And also I will add that to that final few big full signs Ridgeville presence and of these user data

44
00:05:39,490 --> 00:05:48,140
and now I can close this block of commands using Goodbar semicolon and maybe I can put to screen your

45
00:05:48,160 --> 00:05:49,630
data very saved

46
00:05:53,790 --> 00:05:54,100
your

47
00:05:56,950 --> 00:06:08,340
data was saved into employee file.

48
00:06:08,590 --> 00:06:14,820
Now what happens if a user has entered uppercase or lowercase and

49
00:06:18,890 --> 00:06:27,080
before writing commands Please note that I am not using quotation marks around character and this is

50
00:06:27,080 --> 00:06:34,930
not needed as it is only one character which cannot be separated by internal field separator.

51
00:06:34,940 --> 00:06:39,020
My advice for a whole by script is to scroll station Marek's.

52
00:06:39,050 --> 00:06:43,360
If you are working with string which has some space inside.

53
00:06:43,970 --> 00:06:51,420
So if a user entered in a character revealed print nothing was saved.

54
00:06:54,040 --> 00:06:56,140
Around descript again.

55
00:07:02,180 --> 00:07:04,880
If you have an opt

56
00:07:10,340 --> 00:07:19,040
data employee file and finish the section by double semicolon.

57
00:07:19,040 --> 00:07:27,170
Now for a case user will enter something different then why or the character will use asterisk.

58
00:07:27,170 --> 00:07:36,800
But do know why asterisk it is good to mention that gay structure works with wildcards and in the wildcard

59
00:07:36,880 --> 00:07:39,980
as there is a real presence all characters.

60
00:07:40,160 --> 00:07:48,710
So if user didn't answer why or end a character then we will definitely end up in this section because

61
00:07:48,710 --> 00:07:56,090
we are catching all characters here and this is also a reason why we are using asterisk at the bottom

62
00:07:56,330 --> 00:08:03,680
because if we move a static section up for example before section with Vol. II the asterisk section

63
00:08:03,800 --> 00:08:07,180
would be all the better for them and we would never could.

64
00:08:07,190 --> 00:08:15,380
Commands which are inside section we divide value are in sections specified by n character.

65
00:08:15,500 --> 00:08:19,850
So now what would happen if you set or enter to something different.

66
00:08:19,850 --> 00:08:23,180
We will print Verrone answer provided

67
00:08:25,670 --> 00:08:32,280
and we can close the section using double semicolon.

68
00:08:32,300 --> 00:08:41,400
Now we can also close case structure using Issaq keyword so we have basic structure of our script.

69
00:08:41,400 --> 00:08:44,370
But something is missing.

70
00:08:46,110 --> 00:08:52,770
If user will for example ask for yes instead of only y character in that.

71
00:08:52,800 --> 00:08:54,320
Is that correct question.

72
00:08:54,470 --> 00:08:55,920
Descript would reply.

73
00:08:55,920 --> 00:09:00,810
Wrong answer provided and no data will be stored.

74
00:09:00,960 --> 00:09:07,680
User wouldn't need to run the script again so it would be nice to have some option to change user answer

75
00:09:07,910 --> 00:09:10,250
in a case use or provide something different.

76
00:09:10,260 --> 00:09:21,920
And then why or and character and will do that using while loop will keep looping through the code.

77
00:09:22,140 --> 00:09:28,360
If variable called check is equals to zero

78
00:09:34,200 --> 00:09:40,290
now we can specify a body of dialogue using could do and done keyboard

79
00:09:44,190 --> 00:09:52,080
but we should also specify what value has that variable check from the beginning and I will assign zero

80
00:09:52,080 --> 00:09:52,990
to it.

81
00:09:53,520 --> 00:10:00,450
So loop through that code between do and damn if a value of variable check is zero.

82
00:10:00,450 --> 00:10:02,700
Now our Laub would never stop.

83
00:10:02,880 --> 00:10:05,290
As it is 0 and never changing.

84
00:10:05,550 --> 00:10:11,410
So if you want to do a loop to finish we need to change the value of variable check.

85
00:10:11,880 --> 00:10:19,860
So I will invite and and the sections change the value of variable check for example to value 1.

86
00:10:19,860 --> 00:10:22,960
Now if users answer is Y or.

87
00:10:23,010 --> 00:10:26,450
And the value of variable check is not zero.

88
00:10:26,640 --> 00:10:34,150
So that means the loop is finished and won't be repeated if on another case use or first for example

89
00:10:34,150 --> 00:10:41,520
and blah blah he will go to Asterisk section and as there is no changing of value of variable check

90
00:10:42,090 --> 00:10:47,000
then the value of variable check is still 0 and LWB will be continuing with.

91
00:10:47,070 --> 00:10:47,670
Question.

92
00:10:47,670 --> 00:10:49,230
Is that correct.

93
00:10:49,980 --> 00:10:53,380
Now descript is dumb and we can say

94
00:10:58,630 --> 00:11:05,650
ground exec with permission and we can describe no

95
00:11:11,650 --> 00:11:12,650
entry or name.

96
00:11:12,660 --> 00:11:19,980
Peter age 51 Department I-T.

97
00:11:20,490 --> 00:11:21,450
Is that correct.

98
00:11:22,290 --> 00:11:25,070
And Peter says oh I don't have 51.

99
00:11:25,070 --> 00:11:26,080
I'm only 50.

100
00:11:26,100 --> 00:11:27,140
So it is not correct.

101
00:11:27,140 --> 00:11:33,460
So when he Daibes know he got the wrong answer provided as we are taking only the character.

102
00:11:33,480 --> 00:11:42,010
So when he type an he will see nothing was said and the scrip again.

103
00:11:42,320 --> 00:11:44,970
So great it is working perfectly.

104
00:11:45,380 --> 00:12:01,670
So now they're under script again named Peter age 50 Department I.D. and let's say with using Y character

105
00:12:06,340 --> 00:12:09,310
your data were saved in the employee file.

106
00:12:09,310 --> 00:12:12,710
Great except that I have written to him you're dead.

107
00:12:12,760 --> 00:12:14,550
We're saved.

108
00:12:14,900 --> 00:12:18,670
Anyway now let's check that employee file

109
00:12:22,760 --> 00:12:25,540
and we can see that Peter's record over.

110
00:12:25,740 --> 00:12:29,270
Right now we can add another person

111
00:12:34,900 --> 00:12:46,110
Jane age 60 departement age and confident with for example uppercase why and we can check employee file

112
00:12:47,840 --> 00:12:48,350
and grade.

113
00:12:48,380 --> 00:12:49,920
We have two records here.

114
00:12:49,940 --> 00:12:52,950
Screeding works perfectly.

115
00:12:53,170 --> 00:12:55,420
When we go back to scrape

116
00:12:58,160 --> 00:13:03,580
we see that in a while we are starting with line where are we asking users.

117
00:13:03,890 --> 00:13:05,260
Is that correct.

118
00:13:05,360 --> 00:13:07,420
But it is completely up to you.

119
00:13:07,450 --> 00:13:14,440
But to start with it you can for example place the beginning of a while before asking on user name.

120
00:13:14,450 --> 00:13:19,500
So then if it was of reply something different then why or correct that.

121
00:13:19,820 --> 00:13:26,550
Then the user would be forced to enter data as name age and department again.
