Hello and welcome to the and programming language course in the previous session, we talked about copyists
rock type using venue on point of reference and indecision.
We want to talk about the authors this truck's concept.
Anonymous is structure and filled in goal and first anonymous structure.
In go language, you are allowed to create an anonymous structure, an anonymous structure, is there
a structure which does not contain and name it useful when you want to create a one time use able instruct?
You can create an anonymous abstract using the following syntax.
Let's go to a school program to illustrate the concept of anonymous abstract.
First, creating an initializing the anonymous draft now go to main function and define a variable and
assign a strike to it without any name, for the example, a student column, because that's right.
And in these curly brackets defined as strike variable names, a strange
idea and for the example, 64.
And H, it's too early to.
And now open and other actually raucous and initialise defined as starter variables was
name
Julia
Heidi.
A hundred and two and three age 13 now display the anonymous abstract FP.
The student student format, the code, save the project and execute the program.
Go round and go.
Now we can see that we could define an anonymous astronaut, initialize it and display its variables.
Now go to a scientist and continue second anonymous fields in the growth structure, you are allowed
to create anonymous fields.
Anonymous spheres are those fields which do not contain any name.
You just simply mentioned the type of the fields and go will automatically use the type as the name
of the field.
You can create anonymous fields of this destroying using the following syntax in this right you are
not allowed to create two or more fields of the same type.
If you try to do so, the compiler, we give an error.
Let's go to the school program to illustrate the concept of anonymous fields.
First clear, the last court
in this case, creating a structure with anonymous skills tied a student is rocked
and set the type of very extreme
heat.
Now go to main function, assigning values to the anonymous filth of the student, a strike force case
defined and variable on assigned values to it.
For the example, value column equals the student's calibre class and sets the value for the variables
gene.
A hundred and twenty three for each now display the values of the fields.
If we assign a string to a student name and end to a student I.D., the student's name
value does this string and the student I.D. assign value, but it.
Be formatting codes saved the project and executed the program.
Now we can see the output.
We could define an enemy's fields, initializing and display them.
OK, we have reached the end of decision.
I hope you have taken full advantage of decision onto next session.
Goodbye.