diff --git a/lib/elixir/lib/io.ex b/lib/elixir/lib/io.ex index ba4271ffc44..55cc98c9ce4 100644 --- a/lib/elixir/lib/io.ex +++ b/lib/elixir/lib/io.ex @@ -594,11 +594,11 @@ defmodule IO do Another example where you might want to collect a user input every new line and break on an empty line, followed by removing - redundant new line characters (`"\n"`): + redundant new line characters (`"\\n"`): IO.stream(:stdio, :line) - |> Enum.take_while(&(&1 != "\n")) - |> Enum.map(&String.replace(&1, "\n", "")) + |> Enum.take_while(&(&1 != "\\n")) + |> Enum.map(&String.replace(&1, "\\n", "")) """ @spec stream(device, :line | pos_integer) :: Enumerable.t()