Receive the success status of `push!(Set, element)`

You are looking for in! - this does exactly what you want.

The existing in can’t be changed to return a boolean, because that would be a breaking change. The existing behaviour is useful, because it allows you to do stuff like:

with_element = push!(copy(my_set), element)
8 Likes