Hello and welcome to the Golang programming language course in the previous session, we talked about
creating instances of historic times.
And in this session, we want to talk about the other instructions.
Mr Airstrike type, a structure which is the field of another structure is known as nested structure.
A stroke can be nested by creating a stroke type, using other times as the time for the field of a
struct listing given a stroke within another can be useful way to model more complex structures.
Now you can see the syntax for nest at the stroke type.
Now go to this good program to illustrate how to create the nested structure.
First, create a stroke name.
Also tie
hoser.
That's right.
Good practice and set the variable name Estrange
and branch.
This strange.
And year it.
And said a common for export, these distract.
Oh, sir, distract, because first letter of all a is often the case.
So the author of Strike is unexpected, so you must use a comment about this structure.
Now, create another.
It's not like it's art that contains a field as opposed to a structured
time.
It's all this right kid brackets.
In this case, we define an also a that even for the example, we set name of this even as details details
also set the comment for export this right?
It's a story.
Reformat the code and save the project.
Now we could define two astronauts, first author and second, it's on now go to main function and create
an instance of each art instructor, create a variable drawing results from its Art Result column because
it's R. Kelly brackets and initialize its parameters details that it points to also a restaurant.
So we create an instance from Oh sorry, and initialize it.
D turns full circle and assign the values like Julia and four branch e c E. and Year is 2020.
Reformat the code and go to the next line and display the values, the T the turns.
Oh, sir.
Go to the next line, and that's the result reform of the code, said the prosaic, and execute the
program, now we can see the output.
In this example, we were able to create two different structures and use them nested in each other
and display the values of its validators in order not to prolong the time a decision will finish it,
and we will continue the content in the next session.
Goodbye.