Tuesday, September 29, 2015

Helllo World In #Erlang on Mac

Store

-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("hello, world\n").

in a hello.erl file. You can use Sublime as an editor.
[hello_world/0] means function hello_world with zero argument.




Compile the file


erl -compile hello




Open the Erlang Terminal
erl

You can also compile the program in terminal by
c(hello) compiles the file hello.erl




Run the program

hello:hello_world().


Output:
hello, world
ok



To shut a system down cleanly, use init:stop().
Some quick ways are evaluating halt(). or control+\.
control+C a give you access to menus.








No comments:

Post a Comment