Hello and welcome to the Golang programming language course in the last session, we talked about creating
and accessing and adi in this session, we want to talk about the others areas concept.
Initializing and atay with ellipses, then we use ellipses instead of specifying the length.
The compiler can identify the length of an array based on the elements is specified in the added declaration.
Now go to Vesco and do an example.
First, define and add a without specifying the length.
It's Colleen Nichols.
The square brackets and the ellipses
and time and initialize it, 10, comma 20 and comma 30 in this case, compiler defined at a list based
elements now display the length FP rulings or a column
length function X.
Before that, they could save the project, then execute the code.
Now we can see the output length of 83 and we could use from ellipses for defined the length of array.
Now, go to a slide and continue to
initialize values for specific add elements with an added D.
Clearly using an array, literal values can be initialized for specific elements.
Now go to this school to illustrate how to create and add a using a specific area element.
First, clear, the last code
said the project.
Define and add a for the example the X Collin equals score brackets and set the five value for length
of array and set the time curly brackets for initialize the add a for the example one column 10 and
comma three column 30.
Each means any variable of often is assigned to the second element that is index one, and the variable
30 is assigned to the Fourth Element that is Index three now displayed at a
if p, the X serves the project and execute the code.
Now we can see the output.
Zero, 10, zero, 30 and zero.
We could initialize the value 10 and 30 for index one and index three, and the other indexes have this
zero value because we did not assign value to the other indexes and the default value of zero is stored
inside them.
Okay, now go to a slide and continue.
Filter, Ari, elements in go in, go blank.
You can filter add elements.
Now go to this school and illustrate how to use from column symbol for filter areas.
First, clear the last quote.
Said the project and define a string.
My name's Colin.
He calls the score brackets said the lengths five type is a string and initialize the variable
key.
Jeanne.
Be.
Robert?
And, David,
this played out by the following quote if f needs, isn't he, I guess this and her sister value, the
names now save the project and execute the code.
Now we can see the output we create and initialize and add every bill and print it.
Name key gene bill Robert and David.
Now go to the code and use calling for filtering the added element, for the example, the news from
these code names.
Square brackets and set the column, it means extract all elements of names.
Array is starting from zero days till the end.
Now save the project and execute the code.
Now we can see all elements of a printed.
Go to the call, comment this line and go to the next line and do another sample, write the following
quote FP names.
This square bracket, Colleen, three.
Save the project.
It means extra elements of names at a starting from zero index till Turd Index, but not including industry.
Execute the code.
We can't see Gene.
Gene Bill, billary elements from zero till three Bongarts not including in the extreme, do another
example first, come in this line, go to the next line.
FP
names the square brackets for the example to call and save the project to columns.
It means extract elements of names as starting from second index till the end.
Now execute the code.
And we can see the output being Robert and David from second in Nic's until the end of it on another
example on the sly.
Hefty
names.
It's horrible.
I kept von Cullen for youth means extract elements of names is starting from first index teens also
index, but not including index for execute the code.
Now we can see the Output Jean Bill and Robert.
It means from first index to enforce the index, but not including index.
For now, we could use Colin for filtering error.
OK, in order not to prolong the time of decision, we will finish it and we will continue the content
in the next session.
Goodbye.