Representing Values

Values are anything that can represent data in Elixir. They are the number of cars purchased, the text in a blog post, the price of a game, the password text of a login. They are everything a program receives as input, computes, and generates as a result.

Open your IEx shell and type this:

 iex>​ 10
 10

You have typed a value. I know—this short snippet doesn’t look very exciting, but when we think of everything that happens in the background to let us type a value like this, it’s fascinating. When you see it, it’s easy to guess that it represents a number. Literals represent values that humans can easily understand. Elixir does all the work to transform the literals into a format for machines. We only need to worry about ...

Get Learn Functional Programming with Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.