Hello and welcome to the go and programming language course in the previous session.
We could define the variable through this short variable declaration and indecision vivants to do and
other cases.
By using short variable declaration, you are allowed to declare multiple variables of the same type
in the single declaration.
Now let's do an example.
First, define 2D variables in line.
So you write that one comma VAR two comma that three column equals and initialize these variable one
by one, for example, for a valid one.
We initialize a hundred four lakh to Rs 200.
And for that three the initialize it by 300 we declared and initialized in the single line multiple
variables of same types by using short variable declaration.
Now display the value on type of each value, so go to the next line and write it off.
Set the message the value all by one columns percent d because the types of the all variable is integer.
So we set from person the assisting format for all variables and that one and go to the next line and
display type of this value to ifdef the tie.
All that one column person to uppercase and set by one copy these two lines.
Go to a new line.
Paste here and display and other variables that to bar to type is integer
two
and four variable three.
So of use for one person, Diaz formatted string that three.
But three and back to OK to be able to display its value in the output on a new line, views from back
east listening at the end of the message of the comment.
So we pulled back a slash and.
The legislation.
Reformat the code, save the project and execute the program, go to Terminal First, go to Project
Folder, see the variables computer screen and run the program by the Command Go Run thought that's
this made that go.
Now we can see the output.
The value of that of one is 100.
The value of that too is 200, and the value of that tree is 300.
And the types of all variable is it.
Now we want to define another case.
Using short variable declaration, you are allowed to declare multiple variables of different types
in the single declaration.
The type of these variables are determined by the expression.
Now let's do an example.
So first, clear the last code.
Defined three variable, for example, by one comma, that two comma, that three column equals and
initialize this variable is by different types of value, for example, for VAT of on the initialize
it by integer value.
So we set a 100 for it and for that two of initialize it by a string value, for example, gold programming
and for third value about the initialize it by a float value, for example, eighty six point fifty
four.
We declared and initialized in the single line multiple variables of different types by using short
variable declaration now displayed a value on type of the variables.
So we write f f the value of that one column per cent because the type of variable one is integer.
So we use from Person D as formatted and set that one go to the next line and display type of variable
f f it tie.
Oh, that one column per cent to all parties and set that one.
Now copied these two lines and go to a new line, paste here and define another variable for it.
For example, right to be changed format formatted string two per cent s because that type of valuable
to is string.
And for variable three, he changed five three and we changed conversion character two percent f because
the type of batteries followed by a tree, that tree, that tree and set it back as much and in the
end of message of each line back is less.
And I guess that's.
OK, now reformat the call, save the project and execute the program, go to Terminal, Go Round Dot
practice and make that go.
Now we can see the output, the value of that often is 100 and type of it is ain't the value of that
to his GO program and type of it is a strength and the value of that tree is a six point fifty four
and type of it is flawed 64 sixty war.
So we could define multiple variables of different times in the single declaration by using shorthand
variable declaration.
In order not to prolong the time of decision, we will finish it and we will continue the content in
the next session.
Goodbye.