iex> IO.puts "Hello World!"
Hello World!
iex> for n <- [1,2,3,4,5], rem(n,2) == 1, do: n*n
[1, 9, 25]
iex> [1, a] = [1, 2]
iex> a
2
iex> {:ok, [hello: a]} = {:ok, [hello: "world"]}
iex> a
"world"
defmodule Fun do
def fib(0), do: 0
def fib(1), do: 1
def fib(n) do
fib(n-2) + fib(n-1)
end
end
for num <- 1..1000, do: spawn fn -> IO.puts "#{num * 2}" end
task = Task.async fn -> perform_complex_action() end
other_time_consuming_action()
Task.await task