1
00:00:01,190 --> 00:00:08,590
What is a function it is basically lines of code which can be called multiple times within a script.

2
00:00:09,880 --> 00:00:17,650
Functions can be created in two ways in the first the way we are specifying a function name followed

3
00:00:17,650 --> 00:00:25,090
by parentheses and then inside Carol-Lee brackets are lines of code which will be processed.

4
00:00:25,120 --> 00:00:32,560
Second option is to create function using keyboard function then is a name of your function.

5
00:00:32,680 --> 00:00:39,560
And inside the brackets are lines of code which will be processed in this option.

6
00:00:39,570 --> 00:00:48,080
We don't need to use parentheses after name of our function but we need to specify keyboard function.

7
00:00:48,100 --> 00:00:51,460
Here is the example of how we can call function.

8
00:00:51,610 --> 00:00:54,940
Hello from the script and it is really simple.

9
00:00:54,940 --> 00:00:56,880
We just use the name of that function.

10
00:00:56,890 --> 00:00:57,630
In my case.

11
00:00:57,670 --> 00:00:58,730
Hello.

12
00:00:59,110 --> 00:01:05,560
And you may notice that declaration of function Hello is that before the actual calling using function

13
00:01:05,560 --> 00:01:05,930
name.

14
00:01:05,950 --> 00:01:07,090
Hello.

15
00:01:07,480 --> 00:01:10,290
This is all you need to remember.

16
00:01:10,330 --> 00:01:17,980
Function can be called from some place only if declaration of that function Vasa before actual calling

17
00:01:19,890 --> 00:01:23,960
we can of course use arguments when using functions.

18
00:01:24,120 --> 00:01:31,100
Imagine function as some M.R. scrape inside your script here.

19
00:01:31,110 --> 00:01:33,060
For example the calling function.

20
00:01:33,090 --> 00:01:33,780
Hello.

21
00:01:33,870 --> 00:01:37,880
And we are giving to that function one argument name.

22
00:01:37,920 --> 00:01:44,940
Richard as a result function will print hello and value of first argument which is.

23
00:01:44,940 --> 00:01:51,090
Richard we can also exit from function using the return keyboard.

24
00:01:51,410 --> 00:01:56,930
If you use a written keyword we only exit from function not from a script.

25
00:01:57,200 --> 00:02:03,530
And similarly with exit status we can ask for a function that returns status using dollar sign questionmark

26
00:02:03,900 --> 00:02:09,700
year we would get a written status 11 in functions.

27
00:02:09,760 --> 00:02:14,160
We can define local variables or does that means.

28
00:02:14,320 --> 00:02:20,840
It means that local variable is visible only inside the function it was declared.

29
00:02:21,080 --> 00:02:28,760
Here we can see the difference in example on the left side example we are reading the name Richard into

30
00:02:28,780 --> 00:02:32,200
a variable name then we are calling a function.

31
00:02:32,210 --> 00:02:33,870
Hello that argument.

32
00:02:33,880 --> 00:02:43,210
Peter inside function well we assign into variable name Ververs previously value Richard value of argument

33
00:02:43,220 --> 00:02:47,900
1 which is beat Peter after the function is finished.

34
00:02:47,970 --> 00:02:55,250
We are a printing value of variable name which is Peter because we assign this value into variable name

35
00:02:55,520 --> 00:02:56,520
in the function.

36
00:02:56,570 --> 00:02:58,280
Hello.

37
00:02:58,510 --> 00:03:05,110
On the right side example we are reading the name Richard into variable name then calling function a

38
00:03:05,110 --> 00:03:06,630
hello with argument.

39
00:03:06,680 --> 00:03:08,780
Peter an inside function.

40
00:03:08,800 --> 00:03:17,380
Hello we are signing into a local variable name value of argument 1 which is Peter when the function

41
00:03:17,410 --> 00:03:25,240
is finished we are printing Valo of variable name which is richer because we have change only a local

42
00:03:25,240 --> 00:03:29,440
variable name not the global one variable stored value.

43
00:03:29,440 --> 00:03:29,950
Richard.
