1
00:00:13,220 --> 00:00:20,480
Hello and welcome to Golden Programming Languages course in this session, we want to talk about decision

2
00:00:20,480 --> 00:00:21,590
making concert.

3
00:00:26,110 --> 00:00:34,450
Go, Lang, decision making decision making in programming is similar to decision making in real life,

4
00:00:35,860 --> 00:00:37,130
in decision making.

5
00:00:37,150 --> 00:00:41,830
A piece of code is executed when the given condition is fully filled.

6
00:00:42,060 --> 00:00:47,770
Sometimes these are a turn as the control follows, statements go.

7
00:00:47,770 --> 00:00:55,450
Lang uses control statements to control the flow of execution of the program based on certain conditions.

8
00:00:56,620 --> 00:01:03,340
These are used to cause the flow of execution to advanced and branch based on changes to the estate

9
00:01:03,340 --> 00:01:04,100
of the program.

10
00:01:04,840 --> 00:01:12,820
Like most programming languages, Go Blank borrows several of its control flow syntax from the CFMEU

11
00:01:12,820 --> 00:01:13,660
of Languages.

12
00:01:14,350 --> 00:01:15,280
Ingo Lang.

13
00:01:15,550 --> 00:01:23,290
We have the following conditional statements The E-4 statement executes some code in one conditions

14
00:01:23,290 --> 00:01:31,360
through the FLC Elsa statement executes some code if a condition is true and another code if that condition

15
00:01:31,360 --> 00:01:31,960
is false.

16
00:01:32,940 --> 00:01:40,780
This that if a statement you can use one e for else if a statement inside another, if or LCP statements

17
00:01:42,040 --> 00:01:43,420
the f l steve.

18
00:01:43,420 --> 00:01:51,130
As the statement executes different codes for more than two conditions and the suj case, the statements

19
00:01:51,370 --> 00:01:54,670
selects one of many blocks of code to be executed.

20
00:01:57,030 --> 00:01:57,960
If a statement.

21
00:01:59,680 --> 00:02:02,560
This is the simplest decision making a statement.

22
00:02:02,920 --> 00:02:09,190
It is used to decide whether a certain statement or block of his statements will be executed or not.

23
00:02:09,610 --> 00:02:15,520
If a certain condition is true, then a block of a statement is executed, otherwise not.

24
00:02:17,850 --> 00:02:21,330
Now you can see the flow diagram of if a statement.

25
00:02:25,400 --> 00:02:31,850
If the condition of the true value, so if black executed, otherwise, if black does not execute,

26
00:02:32,630 --> 00:02:37,400
now let's go to this school and illustrate how to use if a statement

27
00:02:40,130 --> 00:02:48,410
first go to Project Expeller, create a folder name like decision making.

28
00:02:50,840 --> 00:02:55,550
And define a fine inside, it's like Maine does go.

29
00:02:58,250 --> 00:03:11,390
Said Package name, package main and define the main function, find me OK in this sandpit, we want

30
00:03:11,390 --> 00:03:14,210
to print a message based on the condition.

31
00:03:14,750 --> 00:03:24,230
So first, define two variables like VAT A by the type end and initialize eat what 10 value and define

32
00:03:24,230 --> 00:03:29,870
and other like Line B by the tight end and initialize eight by 20.

33
00:03:31,190 --> 00:03:36,710
Now write a condition for the example if a variable value list, then be variable value.

34
00:03:36,980 --> 00:03:39,130
So print a message for us.

35
00:03:39,140 --> 00:03:40,760
So we run if.

36
00:03:43,250 --> 00:03:50,160
A list and be open and close races and sit out a state mass here.

37
00:03:50,840 --> 00:03:52,280
So we FP.

38
00:03:53,270 --> 00:03:58,310
A value is less than.

39
00:04:00,120 --> 00:04:07,830
Be value, OK, reform at the court, save the project and execute the program, so go to Terminal First,

40
00:04:07,830 --> 00:04:16,080
go to Project Folder, see the decision making funeral scheme and run the program by the comment go

41
00:04:16,080 --> 00:04:18,690
round or back as this may go.

42
00:04:21,240 --> 00:04:23,010
Now you can see the output.

43
00:04:23,670 --> 00:04:26,070
A value is less than be value.

44
00:04:26,670 --> 00:04:30,920
The value of the value of an A is less than the value of the variable P.

45
00:04:31,320 --> 00:04:34,500
It means 10 less than 20.

46
00:04:34,860 --> 00:04:42,450
So our condition returns to value and the statements inside the F block are executed and printed.

47
00:04:42,450 --> 00:04:49,260
The message a value is less than P value in order not to prolong the time of decision.

48
00:04:49,410 --> 00:04:53,130
We will finish it and we will continue the content in the next session.

49
00:04:53,290 --> 00:04:53,820
Goodbye.
