First value different from nothing

Does it exist a generic coalesce function that returns the first value that is not nothing, e.g.

a = nothing
b = nothing
c = "hello"
d = nothing
coalesce(a, b, c, d)

should return “hello”.

It is aptly called something. Example:

julia> something(nothing, "hello", nothing)
"hello"

julia> something(nothing, nothing)
ERROR: ArgumentError: No value arguments present
4 Likes