Function to covert arbitrary data to boolean?

In python we have function bool() that converts to boolean everything, with the same rules as “if” does.
Do we have something similar in Elixir? I.e. for nil and false it will return false, and true for everything else

2 Likes

There is the convention to double bang:

iex> !!nil
false
iex> !!1
true
5 Likes

Thank you, it’s exactly that i needed

1 Like