# On the arbitrariness of truth(iness)

**URL:** https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381
**Category:** Internals & Design
**Created:** [May 20, 2022, 3:32pm UTC](https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381 "2022-05-20T15:32:55Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [May 20, 2022, 7:00pm UTC](https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381/15 "2022-05-20T19:00:50Z")

</div>

`jnz`/`jz` are very useful for pointers.

```julia
if p = function_with_optional_result(...)
    # use p, as it is non-null
end

```

is a common pattern in, for example, the LLVM code base.

I’m not saying this is a better convention than explicit `optional` types (or returning `nothing` that’ll throw an error if you try to use it as a pointer), but it’s still fairly convenient.

Ptr types may not be integers, but it’s fairly reasonable to have them behave the same way, and thus have truthiness of integers also be based on comparison to zero.  
I don’t know the history, but this also fits the pattern of C vs Lisp having settled on different conventions of truthiness for integers.

---

_[View the full topic](https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381)._
