Last active
October 22, 2020 01:19
-
-
Save wende/58a8b130bab7f36d903466286c140aa0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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