Tutorial by Examples

Debugging with IEx.pry/0 is quite simple. require IEx in your module Find the line of code you want to inspect Add IEx.pry after the line Now start your project (e.g. iex -S mix). When the line with IEx.pry/0 is reached the program will stop and you have the chance to inspect. It is like a ...
It is possible to use IO.inspect/1 as a tool to debug an elixir program. defmodule MyModule do def myfunction(argument_1, argument_2) do IO.inspect(argument_1) IO.inspect(argument_2) end end It will print out argument_1 and argument_2 to the console. Since IO.inspect/1 returns i...
defmodule Demo do def foo do 1..10 |> Enum.map(&(&1 * &1)) |> p |> Enum.filter(&rem(&1, 2) == 0) |> p |> Enum.take(3) |> p end defp p(e) do require Logger Logger.debug inspect e, limit: :infinity...
defmodule Demo do def foo do 1..10 |> Enum.map(&(&1 * &1)) |> Enum.filter(&rem(&1, 2) == 0) |> pry |> Enum.take(3) end defp pry(e) do require IEx IEx.pry e end end iex(1)> Demo.foo Request to pry #PID<0.117...

Page 1 of 1