Elixir is a functional, concurrent language built on the Erlang VM.
.ex
- Elixir source code files..exs
- Elixir script files.
A comprehensive cheat sheet for Elixir, covering syntax, data types, control flow, modules, and more, with examples.
Elixir is a functional, concurrent language built on the Erlang VM.
|
Running Elixir Code
|
|
Output
|
Variables are immutable; you cannot change the value of an existing variable. |
|
|
Nil/null value. |
|
Boolean values. |
|
Integer (ASCII) value. |
|
Integer value. |
|
Float value. |
|
Charlist (list of characters). |
|
Binary data. |
|
Binary string. |
|
Atom (a constant with name). |
|
List (ordered collection). |
|
Tuple (ordered, fixed-size collection). |
|
Map (key-value pairs). |
|
Struct (extension of map, with predefined keys). |
Anonymous function (lambda). |
Functions to check the type of a value. |
If
|
Case
|
Cond
|
With
|
|
|
Not equal. |
|
Strict not equal(no type conversion). |
|
Concatenate lists. |
|
Concatenate string/binary. |
|
Regexp match. |
|
Accessing a Function:
|
|
Example:
can be written as
|
|
Shorthand Syntax
|
|
|
|
For Loops
Conditions
Into
|
|
|
|