Erlang Learning Notes (i)

Source: Internet
Author: User

Erlang Installation

Online page http://www.erlang.org/download.html. Select the appropriate platform on the page. The proposed Erlang learning platform is Linux or UNIX.
For Linux or UNIX-series platforms, download Souce File directly and compile the installation.

The code is as follows Copy Code

wget http://www.erlang.org/download/otp_src_17.0.tar.gz
TAR-XZVF otp_src_17.0.tar.gz
CD otp_src_17.0
./configure
Make
sudo make install

After the installation is complete, Erlang's binary path is/usr/local/bin/erl
The Hello World of Erlang

Save the following Hello wolrd program as Hello.erl

The code is as follows Copy Code

-module (hello).
-export ([hello_world/0]).
Hello_world ()-> io:fwrite ("Hello, worldn").

Compile our hellowolrd, execute the/usr/local/bin/erl into the Erlang Shell, and then enter the following execution on the Erl file just compiled

The code is as follows Copy Code

ERLANG/OTP [erts-6.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [Kernel-poll:false]

Eshell V6.0 (abort with ^g)
1> C (Hello).
{Ok,hello}

Execute HelloWorld

2> Hello:hello_world ().
Hello, world
Ok

Well, Erlang's HelloWorld is done.
How to exit the Erlang Shell

First into the Erlang Shell, overwhelmed, how to exit it?
There are several ways to exit the Erlang shell

Command mode 1: Execute Init:stop ().
Command mode 2: Execute Halt ().
Shortcut key Way 1:control+c then choose a
Shortcut key Way 2:control+g then press Q

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.