Answers for "elixir new structs"

0

elixir new structs

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"}
Posted by: Guest on January-07-2022

Browse Popular Code Answers by Language