Skip to content

Commit d80e049

Browse files
committed
[Add] if, lists, map, map with pattern matching examples
1 parent d05c810 commit d80e049

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

if.exs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IO.puts if false, do: :this, else: :that

lists.exs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
list = [{:first_name, "Mauricio"}, {:last_name, "Serna"}]
2+
3+
list2 = [first_name: "Mauricio", last_name: "Serna"]
4+
5+
IO.puts list === list2

map.exs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
map = %{:first_name => "Mauricio", :last_name => "Serna"}
2+
3+
IO.puts map[:first_name]
4+
IO.puts map[:last_name]

map_with_pattern_matching.exs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%{} = %{:a => 1, 2 => :b}
2+
3+
%{:a => a} = %{:a => 1, 2 => :b}
4+
5+
IO.puts a

0 commit comments

Comments
 (0)