🐝Types

As mentioned in Why functional programming?, one of functional programming's draws is the type system. This is no exception in Elixir.

Elixir is a dynamically typed language. This means that rather than declaring the type of variables during initialization like in languages like Java (int x = 0;), you simply initialize the variable with the appropriate value x = 0 and the compiler is able to recognize the appropriate type for the variable.

Elixir relies on tools like the dialyzer to provide type checking using type annotations.

Unlike other dynamic languages like Python, Elixir's use of referential transparency means that the value of a variable cannot be changed once it has been initialized so all references to that variable before any re-assignments will not be affected by a re-assignment.

Reading function signatures

There will be points in the guide where I refer to a function via the following notation: function_name/arity. For instance, or/2.

The arity of a function refers to the number of arguments that the function receives. For more information about the function, you can use h function_name/arity in IEx to get the help documentation.

Last updated