File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -467,32 +467,36 @@ defmodule IO do
467467
468468 ## Examples
469469
470+ The following code:
471+
470472 IO.inspect(<<0, 1, 2>>, width: 40)
471473
472474 Prints:
473475
474476 <<0, 1, 2>>
475477
476- We can use the `:label` option to decorate the output:
478+ You can use the `:label` option to decorate the output:
477479
478480 IO.inspect(1..100, label: "a wonderful range")
479481
480482 Prints:
481483
482484 a wonderful range: 1..100
483485
484- The `:label` option is especially useful with pipelines:
486+ Inspect truncates large inputs by default. The `:printable_limit` controls
487+ the limit for strings and other string-like constructs (such as charlists):
485488
486- [1, 2, 3]
487- |> IO.inspect(label: "before")
488- |> Enum.map(&(&1 * 2))
489- |> IO.inspect(label: "after")
490- |> Enum.sum()
489+ "abc"
490+ |> String.duplicate(9001)
491+ |> IO.inspect(printable_limit: :infinity)
491492
492- Prints:
493+ For containers such as lists, maps, and tuples, the number of entries
494+ is managed by the `:limit` option:
493495
494- before: [1, 2, 3]
495- after: [2, 4, 6]
496+ 1..100
497+ |> Enum.map(& {&1, &1})
498+ |> Enum.into(%{})
499+ |> IO.inspect(limit: :infinity)
496500
497501 """
498502 @ spec inspect ( item , inspect_opts ) :: item when item: var
You can’t perform that action at this time.
0 commit comments