Skip to content

Instantly share code, notes, and snippets.

@wende
Last active October 22, 2020 01:19
Show Gist options
  • Save wende/58a8b130bab7f36d903466286c140aa0 to your computer and use it in GitHub Desktop.
Save wende/58a8b130bab7f36d903466286c140aa0 to your computer and use it in GitHub Desktop.
defmodule Janusz do
def homework() do
1..7
|> Enum.map(fn _ -> :rand.uniform * 10 |> round() end)
|> IO.inspect()
|> Enum.count(fn x -> x > 5 end)
|> Kernel.>(3)
|> case do
true -> "Więcej"
false -> "Mniej"
end
end
end
Janusz.homework() |> IO.inspect
defmodule Janusz do
def homework() do
1..7
|> Enum.map(fn _ -> :rand.uniform * 10 |> round() end)
|> IO.inspect()
|> Enum.count(fn x -> x > 5 end)
|> Kernel.>(3)
|> if(do: "Więcej", else: "Mniej")
end
end
Janusz.homework() |> IO.inspect
defmodule Janusz do
def homework() do
wynik =
1..7
|> Enum.map(fn _ -> :rand.uniform * 10 |> round() end)
|> IO.inspect()
|> Enum.count(fn x -> x > 5 end)
|> Kernel.>(3)
if wynik do
"Więcej"
else
"Mniej
end
end
end
Janusz.homework() |> IO.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment