Elixir New Structs

[Solved] Elixir New Structs | Elixir - Code Explorer | yomemimo.com
Question : elixir new structs

Answered by : nguyen-quang-huy

iex> defmodule User do
...> defstruct name: "John", age: 27
...> end
iex> %User{}
%User{age: 27, name: "John"}
iex> %User{name: "Jane"}
%User{age: 27, name: "Jane"}

Source : https://elixir-lang.org/getting-started/structs.html | Last Update : Fri, 14 Jan 22

Answers related to elixir new structs

Code Explorer Popular Question For Elixir