本文共 365 字,大约阅读时间需要 1 分钟。
概要:《Erlang程序设计》第六章中的例子。
hello.erl
-module(hello).-export([start/0]).start() -> io:format("Hello world ~n").
shop.erl
-module(shop).-export([cost/1]).cost(oranges) -> 5;cost(newspaper) -> 8;cost(apples) -> 2;cost(pears) -> 9;cost(milk) -> 7.
makefile
.SUFFIXES: .erl .beam.erl.beam: erlc -W $
保存在同一文件夹下。执行:erl -make。编译成功,会出现hello.beam和shop.beam。
参考资料:
《Erlang程序设计》
转载地址:http://dpqli.baihongyu.com/