DEV Community

Luis Gustavo Caciatori
Luis Gustavo Caciatori

Posted on

2 2

TIL IEX Console #1

TIL a small trick on Elixir console (iex) that is the helper i/1

When you type some piece of code on iex e.g:

iex(1)> IO.inspect {:a, :b}
{:a, :b}
Enter fullscreen mode Exit fullscreen mode

And after that you type i. This helper will print the type information about the last command typed on iex.

iex(1)> I
Term
  {:a, :b}
Data type
  Tuple
Reference modules
  Tuple
Implemented protocols
  IEx.Info, Inspect
Enter fullscreen mode Exit fullscreen mode

You also can specify a term to the helper as on the example below.

iex(3)> i (4 / 2)
Term
  2.0
Data type
  Float
Reference modules
  Float
Implemented protocols
  IEx.Info, Inspect, List.Chars, String.Chars

iex(4)> i "hello"
Term
  "hello"
Data type
  BitString
Byte size
  5
Description
  This is a string: a UTF-8 encoded binary. It's printed surrounded by
  "double quotes" because all UTF-8 encoded code points in it are printable.
Raw representation
  <<104, 101, 108, 108, 111>>
Reference modules
  String, :binary
Implemented protocols
  Collectable, IEx.Info, Inspect, List.Chars, String.Chars
Enter fullscreen mode Exit fullscreen mode

And that's it for today.

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay