-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsequential.erl
More file actions
84 lines (46 loc) · 1.61 KB
/
sequential.erl
File metadata and controls
84 lines (46 loc) · 1.61 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
%%%-------------------------------------------------------------------
%%% @author Chris Duesing <chris.duesing@gmail.com>
%%% @copyright (C) 2010, Chris Duesing
%%% @doc
%%%
%%% @end
%%% Created : 18 Apr 2010 by Chris Duesing <chris.duesing@gmail.com>
%%%-------------------------------------------------------------------
-module(sequential).
%% API
-export([single_assignment/0, lists/0, tuples/0, binaries/0]).
%%%===================================================================
%%% API
%%%===================================================================
%%--------------------------------------------------------------------
%% @doc
%% @spec
%% @end
%%--------------------------------------------------------------------
single_assignment() ->
X = 5,
X = 4.
lists() ->
L = [1, 2, 3],
io:format("~p~n", [L]),
X = lists:nth(2, L),
io:format("2nd element is ~w~n", [X]),
[A, B, C] = [1, 2, 3],
io:format("B equals ~p~n", [B]),
[Head | Tail] = [1, 2, 3],
io:format("Head equals ~p~n", [Head]),
io:format("Tail equals ~p~n", [Tail]),
[H | T] = "Hello World",
io:format("head equals ~p~n", [H]),
io:format("tail equals ~p~n", [T]).
tuples() ->
X = {1, 2, elephant},
Nested = {X, {name, "Chris"}, [1, 2, 3]},
{Y, Z} = {3, 4}.
binaries() ->
Binary = <<3,4,5>>,
AnotherBinary = <<"Chris">>,
<<A, B, C/binary>> = <<1, 2, "Chris">>.
%%%===================================================================
%%% Internal functions
%%%===================================================================