erlang蜗牛学习中(二)

test2.erl

-module(test2).

-export([ttt/0]).

ttt()->
inets:start(),
case httpc:request(“http://www.baidu.com”) of
{ok,_Result}->
io:format(“hello ok”);
{error,_Reason}->
io:format(“hello error”)
end.

了解了用case来进行返回值不同的匹配。

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>