Last active
June 26, 2019 16:26
-
-
Save rodesousa/397112294929c035f8d969e36c8294cb to your computer and use it in GitHub Desktop.
some elixir code
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
# to know type | |
i type | |
IO.inspect type | |
# range | |
players = | |
1..12 | |
|> Enum.map(fn _ -> %Player{} end) | |
# Ecto // db | |
mix ecto.create | |
# Struct | |
defmodule User do | |
defstruct email: nil | |
end | |
%User{email: "c@c.com"} = struct(%User{}, email: "c@c.com") | |
# Help | |
%User{email: "a@a.co"} = %{ %User{} | email: "a@a.co" } | |
%User{email: "b@b.com"} = Map.put(%User{}, :email, "b@b.com") | |
# Default | |
def test(a \\ "aze") do | |
IO.puts(a) | |
end | |
# Help | |
h(Map.replace!) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment