Sometimes we have a key that we no longer need in our map.
Go allows us to remove elements using the
Let’s say we want to remove a contact from our phone:
If we call the
delete function with a key that is not in the map nothing bad happens. Other languages may crash or throw an exception!
Let’s practice the delete operation and then we will review everything that we have learned.
delete all the
Then print out the donuts map again after your delete statement.
Take this course for free