# First value different from nothing

**URL:** https://discourse.julialang.org/t/first-value-different-from-nothing/80818
**Category:** New to Julia
**Created:** [May 10, 2022, 2:56pm UTC](https://discourse.julialang.org/t/first-value-different-from-nothing/80818 "2022-05-10T14:56:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![whatsthecraic](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@whatsthecraic](https://discourse.julialang.org/u/whatsthecraic)
#### Post date: [May 10, 2022, 2:56pm UTC](https://discourse.julialang.org/t/first-value-different-from-nothing/80818/1 "2022-05-10T14:56:57Z")

</div>

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

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

```

should return “hello”.

---

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [May 10, 2022, 2:58pm UTC](https://discourse.julialang.org/t/first-value-different-from-nothing/80818/2 "2022-05-10T14:58:11Z")

</div>

It is aptly called [`something`](https://docs.julialang.org/en/v1/base/base/#Base.something). Example:

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

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

```
