Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanding on maps delete to make it more consistent with add and update #787

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

reyncode
Copy link

In this PR I expanded on the Delete method in the maps chapter to be consistent with other CRUD operations in the case that the word being deleted does not exist. The same Update switch structure is used to capture errors with a minor change ErrWordDoesNotExist to make it applicable to both update and delete operations.

@nivethan-me
Copy link

it seems like the current version is more consistent with the language. since delete(map, key) doesn’t return anything, and will do nothing if the specified key doesn’t exist in Go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants