Števo Bačkor's public notes

Debuggin Elixir variables

April 02, 2019

To print out Elixir variable type in interactive console

iex> foo = 25
iex> IEx.Info.info(foo)
[{"Data type", "Integer"}, {"Reference modules", "Integer"}]

IEx.Info.info actually returns structured info. To print out variable type in your code use inspect

foo = %{id: 25}
foo |> IEx.Info.info() |> IO.inspect()

which will stdout this

[{"Data type", "Map"}, {"Reference modules", "Map"}]

Enjoy awesome Elixir!


Štefan Bačkor

Written by Štefan Bačkor who lives and works from Slovakia. You should check his Twitter or Github