-module(helloworld).
-export([start/0]).
start() ->
A = fun() -> io:fwrite("Hello") end,
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[binary_to_atom(<<"Erlang">>, latin1)]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[binary_to_list(<<2,1>>)]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[binary_to_integer(<<"2">>)]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[binary_to_float(<<"2.2">>)]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[erlang:now()]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~w~n",[erlang:ports()]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[erlang:processes()]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[erlang:universaltime()]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[<<5,10,20>>]),
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[list_to_binary([1,2,3])]).
-module(helloworld).
-export([start/0]).
start() ->
Fn = fun() ->
io:fwrite("Anonymous Function") end,
-module(helloworld).
-export([max/1,start/0]).
max(N) ->
Max = erlang:system_info(process_limit),
-module(helloworld).
-export([loop/0,start/0]).
loop() ->
receive
{rectangle, Width, Ht} ->
io:fwrite("Area of rectangle is ~p~n" ,[Width * Ht]),
-module(helloworld).
-export([start/0]).
start() ->
Pid = spawn(fun() -> server("Hello") end),
-module(helloworld).
-export([start/0]).
start() ->
spawn(fun() -> server("Hello") end).
-module(helloworld).
-export([start/0]).
start() ->
spawn_link(node(),fun() -> server("Hello") end).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p",[is_alive()]).
-module(helloworld).
-export([start/0]).
start() ->
spawn(node(),fun() -> server("Hello") end).
% Erlang节点分布式编程
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p",[node()]).
-module(helloworld).
-export([start/0]).
start() ->
spawn(fun() -> server("Hello") end).
-module(helloworld).
-export([start/0,client/1]).
start() ->
spawn(fun() -> server(4000) end).
server(Port) ->
-module(helloworld).
-export([start/0]).
start() ->
{ok, Socket} = gen_udp:open(8789),
io:fwrite("~p",[Socket]),
-module(helloworld).
-export([start/0]).
start() ->
{ok, Socket} = gen_udp:open(8789),
io:fwrite("~p",[Socket]).
-module(helloworld).
-export([start/0, call/2]).
call(Arg1, Arg2) ->
io:fwrite("~p~n",[Arg1]).
-module(helloworld).
-export([start/0, call/2]).
call(Arg1, Arg2) ->
io:fwrite("~p~n",[Arg1]).
-module(helloworld).
-export([start/0, call/2]).
call(Arg1, Arg2) ->
io:fwrite("~p~n",[Arg1]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[self()]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[registered()]).