Hello and welcome to the Golang program language course in the previous session, we talked about sort
map and in decision, we want to talk about the others map concept.
TRUNCATE map, there are two methods to clear all items from a map.
First, remove all keys via the falou and second define the make function for the existing map variables.
Now, go to this school to illustrate how to truncate map.
First, create a map and initialize it.
My map, call it equals map.
Said and as the index Typekit and said Estrange as a value target and initialize eight 10, Colin Keane,
20, calling June
30 Colin Alex
now displayed a created map variable for index
comma value column equals rearrange my map and this spelling by the comment if if index first sent the
package city for a space between index and value value person.
Yes, and I can stash and set index and value
the format they call and say the project.
Now we want to delete all keys by full loop and delete function.
Go to the next line and Fold I column equals branch in my map
and delete
minor and set index.
I
now display my body will again be my map.
After deleting.
Go to the next line and see
my map, reformat the code, save the project and execute the program.
Now we can see the output.
First, we display all elements of map and then truncate and display it, and we see on elements of
Map Body that have deleted.
In second method, we want to use make function to truncate the map barrier, but first clear the last
code.
And remove the delete function, create a very able and initialize it, display the elements of it.
In this case, we said make function right hand of existing, my body in my map equals me function said
eat as index and sit as string as value time.
Save the project and execute the code again.
Now we can see the output in this case also, we display all elements of math and then truncate map
variation by the main function and display it.
And we see all elements of map a bit have deleted in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.