We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17359c4 commit f18113fCopy full SHA for f18113f
examples/simple_app/lib/simple_app/struct_example.ex
@@ -0,0 +1,16 @@
1
+defmodule SimpleApp.StructExample do
2
+ defmodule SomeStruct do
3
+ defstruct [name: "John Smith", age: 25]
4
+ end
5
+
6
+ @type t :: %SomeStruct{}
7
8
+ @spec age(t) :: non_neg_integer
9
+ def age(%SomeStruct{age: age}), do: age
10
11
+ @spec mistake :: :ok
12
+ def mistake do
13
+ age(%{first: "John", last: "Smith", age: 32})
14
15
16
+end
0 commit comments