Skip to content

Add get_or_insert method.#17

Merged
jemc merged 1 commit intomainfrom
add/get-or-insert
Jul 5, 2024
Merged

Add get_or_insert method.#17
jemc merged 1 commit intomainfrom
add/get-or-insert

Conversation

@jemc
Copy link
Contributor

@jemc jemc commented Jul 5, 2024

Return the value assigned to the given key, if present.

If the key is not present, the given yield block will be executed to provide a value to assign to the key, which will also be returned.

If the key was already present, the yield block will not be executed.

Return the value assigned to the given key, if present.

If the key is not present, the given yield block will be executed to
provide a value to assign to the key, which will also be returned.

If the key was already present, the yield block will not be executed.
@jemc jemc self-assigned this Jul 5, 2024
@jemc jemc merged commit 49ac11f into main Jul 5, 2024
@jemc jemc deleted the add/get-or-insert branch July 5, 2024 02:05
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.

1 participant