1) What is Elixir?
Elixir is a dynamic, functional language. It is designed to build scalable and maintainable applications.
2) Who developed Elixir?
Ericsson developed elixir in 1986.
3) What is the stable version of Elixir?
The stable version of Elixir is
1.5.1 and released on 1 August 2017.
4) What are the features of Elixir?
The following features of Elixir are:
- Scalability
- Fault tolerance
- Functional programming
- Build tools
- Erlang Compatibility
5) How to write a simple program?
The following code to write a simple program:
IO.puts "Hello world"Which
6) Which platform is used to run Elixir?
BEAM (Erlang virtual machine) platform is used to run Elixir.
7) What is the use of Spawn functions?
The Spawn function is used to create a new process.
Example:
pid = spawn(fn -> 2 * 2 end)
Process.alive?(pid)
8) What is Sigils in Elixir?
Elixir is a mechanism, used to textual representations with the language. It starts with tilde (~) character.
9) How to create a Map in Elixir??
A Map is created by using %{} syntax.
map = %{:a => 1, 2 => :b}
10) What are the operators in Elixir?
There are following operators in Elixir:
- Arithmetic operators
- Comparison operators
- Boolean operators
- Misc operators
11) What do you mean by String Interpolation in Elixir?
String interpolation is a way to construct a new String value. The code is wrap with curly braces and '#' sign.
Example:
x = "Apocalypse"
y = "X-men #{x}"
IO.puts(y)
12) What is the use of Crypto Module in Elixir?
In Elixir, the crypto module is used to decrypt our project applications. It uses hashing function and digital signature.
Example:
IO.puts(Base.encode16(:crypto.hash(:sha256, "Elixir")))
13) How can we define Structs?
We can define Structs by using
defstruct
iex> defmodule User do
...> defstruct name: "John", age: 27
...> end
14) What is match operator in Elixir?
In elixir, = operator is match operator.
Example