Hello and welcome to go dang programming language course in that part of your session, we talked about
Eve as if else statement and indecision.
We want to talk about the author's decision making consent.
So it's a statement as such, a statement is a multiday branch statement.
It provides an efficient way to transfer the execution to different parts of the code based on the value
also called case of the expression GO language support two types of seizure statements first, expressions
to each and second type such expressions, which is similar to such a statement in C or C++ or Java
language.
It provides an easy way to dispatch execution to different parts of code based on the value of the expression.
Now you can see the syntax.
Let's go to this school and illustrate how to use such a statement.
In this example, we want to assign a number to each day of the week and implement it through the expression
search.
First, define a variable like today.
So we write that today by the tight end and initialize it by two.
Now write the switch case on the two day variable.
So we write to each week and close Kelly races and define Chase.
For example, for the first case, we assign one menu for two.
They vary a bit.
So we write Chase today equal equal one column.
And in this case, it is a statement for this case, for example.
AFP two day is Monday.
Go to the next line and define and other cases, for example, in chase today.
Equal equals to Colin.
Go to the next line.
And so their statement FP.
Tuesday is Tuesday.
Go to the next line.
Define another case.
Case today.
Equal, Equal three, Colin said this statement for this case, for example FP.
Tuesday is Wednesday.
And go to the next line and define another case, for example, shares today equal equals four column
call to the next line and set a statement for this case.
50 Today is Thursday.
Case.
Today he calls five column FP.
Tuesday is Friday.
And case.
To the.
Equals six Column V said in a statement like today is Saturday.
And case today equal equals seven.
So be right, FP.
Today is Sunday.
Change and go to the next line and define a default based solely right default and cities statement
for it, for example, FP value for today is in.
OK.
Reformat the cord, save the project and execute the program.
Now go to terminal and run the program where they can't go wrong, but I guess this man that go?
Now we can see the output today is Tuesday because we are sunk to value to two day variables, so compiler
executed the case that two day assigned by two value and the returns, the two day is Tuesday.
Now go to his lies and continue types, which tied switch is used.
Then you want to compare types in this search.
They chase contains the types which is going to compare with the tie present in the search expiration.
Now you can see the syntax.
Let's go to this school curriculum and illustrate how to use types which.
First, define an empty interface that has industry value.
So you write that define a and like value by the tight end to interface
and initialize it by a string value, for example, go through or any language.
Now, go to the next line and define a switch case to find out the interface type, so the right switch
you find a variable like a column equals.
Value door, open and close parenthesis and sit tight for it,
open and close curly braces.
Now define Chasez to check the condition.
In this case, we put date or time.
For example, if time is an integer, so be right case in 64 case in 64 colour and set a statement for
this case, for example FP.
Time is integer column and set variable.
A go to the next line and define and other cases.
For example, type of floating point numbers override case floats 64 column and said a statement for
this case if FP.
Typekit is Lord Colin and said Set had a go to the next time and defined as string tied, for example,
case history, Colin and said a statement for this case, F.P. time is history, colour and said value
than a F-Type is other than these three.
We define default keyboard, so go to the next line and define default keyboard Colin and said a statement
for this FP.
Time is on reformat the code, save the project and execute the program.
Now, go to turn on and run the program by the command.
Go run thought back.
Does this mean that go?
Now we can see the output type is strong and values go programming language because we initialize antinori
face value by issuing tide, so extreme case has returned for us.
We have reached the end of decision.
I hope you take full advantage of this session until next session.
Goodbye.