-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatternMatchingOne.ex
More file actions
89 lines (71 loc) · 1.2 KB
/
PatternMatchingOne.ex
File metadata and controls
89 lines (71 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
defmodule PatternMatchingOne do
@moduledoc """
Documentation for PatternMatchingOne
"""
@doc """
function_a
## Examples
iex> PatternMatchingOne.function_a
[1,2,3]
"""
def function_a do
a = [1,2,3]
a
end
@doc """
function_b
## Examples
iex> PatternMatchingOne.function_b
4
"""
def function_b do
a = 4
a
end
@doc """
function_c
## Examples
iex> PatternMatchingOne.function_c
4
"""
def function_c do
a=4
4=a
end
@doc """
function_d
## Examples
iex> PatternMatchingOne.function_d
** (MatchError) no match of right hand side value: [1, 2, 3]
"""
def function_d do
[_a,_b] = [1,2,3]
end
@doc """
function_e
## Examples
iex> PatternMatchingOne.function_e
[[1,2,3]]
"""
def function_e do
_a = [[1,2,3]]
end
@doc """
function_f
## Examples
iex> PatternMatchingOne.function_f
[[1,2,3]]
"""
def function_f do
[_a] = [[1,2,3]]
end
@doc """
function_g
## Examples
iex> PatternMatchingOne.function_g
** (MatchError) no match of right hand side value: [[1, 2, 3]]
"""
def function_g do
[[_a]] = [[1,2,3]]
end
end