-
Notifications
You must be signed in to change notification settings - Fork 0
/
dolphins.erl
37 lines (33 loc) · 1 KB
/
dolphins.erl
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
-module(dolphins).
-compile(export_all).
% 12.4 さようなら、いままで魚をありがとう!
dolphin1() ->
receive
do_a_flip ->
io:format("How about no? ~n");
fish ->
io:format("So long and thanks for all the fish ~n");
_->
io:format("Heh, were smarter than you humans ~n")
end.
% 毎回プロセスを立ち上がる必要がある
dolphin2() ->
receive
{From, do_a_flip} ->
From ! "How about no?";
{From, fish} ->
From ! "So long and thanks for all the fish!";
_->
io:format("Heh, were smarter than you humans. ~n")
end.
% 常にメッセージを受けとれるジョウタいにする
dolphin3() ->
receive
{From, do_a_flip} ->
From ! "How about no?";
{From, fish} ->
From ! "So long and thanks for all the fish!";
_->
io:format("Heh, were smarter than you humans. ~n"),
dolphin3()
end.