先创建一个helloworld.erl文件,文件内容如下:
%% This is a simple Erlang module
% 模块声明
-module(helloworld).
% 函数导出声明
-export([pie/0]).
% Test pie
pie() ->
3.14.
通过shell编译、执行:
$ erl
Erlang R16B03 (erts-5.10.4) [source] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.4 (abort with ^G)
1> c(helloworld).
{ok,helloworld}
2> helloworld:pie().
3.14
3>