-module(tut2).
-export([convert/2]).
convert(M, inch) -> M / 2.54.
convert(N, centimeter) -> N * 2.54.
编译上面模块的时候会出错,提示如下:
-export([convert/2]).
convert(M, inch) -> M / 2.54.
convert(N, centimeter) -> N * 2.54.
编译上面模块的时候会出错,提示如下:
tut2.erl:6: function convert/2 already defined
列子Erlang Shell版本:Eshell V5.9.1
OMG, 代码敲错了,倒数第二行应该是 “;”结束,粗心啊!!!
正确的如下:
-module(tut2).
-export([convert/2]).
convert(M, inch) -> M / 2.54;
convert(N, centimeter) -> N * 2.54.
---------------------------------------------------------
欢迎关注我的微信公众号 ^_^