mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Fix typo in words calculate and area
This commit is contained in:
parent
23e33df076
commit
faa297157a
@ -260,22 +260,22 @@ spawn(F). % <0.44.0>
|
|||||||
% For all of this to be useful we need to be able to receive messages. This is
|
% For all of this to be useful we need to be able to receive messages. This is
|
||||||
% achieved with the `receive` mechanism:
|
% achieved with the `receive` mechanism:
|
||||||
|
|
||||||
-module(caculateGeometry).
|
-module(calculateGeometry).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
caculateAera() ->
|
calculateArea() ->
|
||||||
receive
|
receive
|
||||||
{rectangle, W, H} ->
|
{rectangle, W, H} ->
|
||||||
W * H;
|
W * H;
|
||||||
{circle, R} ->
|
{circle, R} ->
|
||||||
3.14 * R * R;
|
3.14 * R * R;
|
||||||
_ ->
|
_ ->
|
||||||
io:format("We can only caculate area of rectangles or circles.")
|
io:format("We can only calculate area of rectangles or circles.")
|
||||||
end.
|
end.
|
||||||
|
|
||||||
% Compile the module and create a process that evaluates `caculateAera` in the shell
|
% Compile the module and create a process that evaluates `calculateArea` in the shell
|
||||||
c(caculateGeometry).
|
c(calculateGeometry).
|
||||||
CaculateAera = spawn(caculateGeometry, caculateAera, []).
|
CalculateArea = spawn(calculateGeometry, calculateAera, []).
|
||||||
CaculateAera ! {circle, 2}. % 12.56000000000000049738
|
CalculateArea ! {circle, 2}. % 12.56000000000000049738
|
||||||
|
|
||||||
% The shell is also a process, you can use `self` to get the current pid
|
% The shell is also a process, you can use `self` to get the current pid
|
||||||
self(). % <0.41.0>
|
self(). % <0.41.0>
|
||||||
|
Loading…
Reference in New Issue
Block a user