Forum Thread: Learn Erlang

##This guide was written to suite Kali Linux users and code examples shown below were written and compiled in Kali Linux terminal

##But the code examples can run on Windows just install werl its the windows version for erl

Hello everyone if any of you will be reading this, it means you choose to learn Erlang and i got a lot to share with you.

So lets get you through Erlang, hoping what you will learn will be enough to make you understand the basics of Erlang and to understand any Erlang code you may come across, out there.

So lets start by the basics, Erlang is available on the Linux terminal all you need to do is type "erl" when i say "erl" i mean type this erl and you will see this:

Erlang/OTP 19 erts-8.2.1 source 64-bit smp:4:4 async-threads:10 kernel-poll:false

Eshell V8.2.1 (abort with ^G)
1>

Psssssss:

OK so far so good, so in case i forgot to mention Erlang pretty much works runs on modules you will learn to make, and compiles them into .beam which basically runs on

a virtual environment within your shell, "You are free to lookup how the .beam stuff works in case my knowledge on the content is shallow, but hey i am dropping the

basics" "i mentioned modules since any function you will learn to make within the shell becomes erased whenever you exit the terminal,so it will be good practice to

learn how to write and work with modules, lets call them code safe houses"

Ok getting started:

  1. You will need to know how to move around the Erlang shell as your first lesson:

Erlang adopts similar commands but in this case they are functions, for example the cd command in Linux or windows allows you to change your directory to a newly

specified directory in Erlang this is how it looks like cd(). but it takes your statement in-order to work:

Example:
root@Martin-0596:~# erl

Erlang/OTP 19 erts-8.2.1 source 64-bit smp:4:4 async-threads:10 kernel-poll:false

Eshell V8.2.1 (abort with ^G)
1> cd("Desktop").
/root/Desktop
ok
2>

There you have it and FYI don't forget to add the full stop after your code otherwise you wont get your required feedback.

Moving on to the second basic you will need to learn is the ls(). function as all of you may know it enables you to look around your current directory.

Example:

root@Martin-0596:~# erl

Erlang/OTP 19 erts-8.2.1 source 64-bit smp:4:4 async-threads:10 kernel-poll:false

Eshell V8.2.1 (abort with ^G)
1> cd("Desktop").
/root/Desktop
ok
2> ls().
.swp
C
C++
Erlang
Flask
Html5
Patch.zip
Python
Telegram
The cost of happiness.txt
epic.jpeg
sgi.cpp
sort
stock-vector-quality-coding-concept-design-on

ok

There you have it thats my desktop so try navigating around the Erlang shell in-order to become more familiar with your new environment in case this is your first time

with Erlang.

Erlang can also calculate Mathematical equations from the basic to the complex ones out there as long as you know the order of sequence, i will show you a brief demo.

root@Martin-0596:~# erl

Erlang/OTP 19 erts-8.2.1 source 64-bit smp:4:4 async-threads:10 kernel-poll:false

Eshell V8.2.1 (abort with ^G)
1> 1+1.
2
2> 10+15*(12/10).
28.0
3> 845/5+(1210-100/56).
169.0
4>

Anywhere those are a few of the basic calculation i could show you, you can get creative and create your own complex equations anyway lets wrap up this beginner tutorial

by showing you how to exit your Erlang terminal.

root@Martin-0596:~# erl

Erlang/OTP 19 erts-8.2.1 source 64-bit smp:4:4 async-threads:10 kernel-poll:false

Eshell V8.2.1 (abort with ^G)
1> 1+1.
2
2> 10+15*(12/10).
28.0
3> 845/5+(1210-100/56).
169.0
4> q().
ok
5> root@Martin-0596:~#

There you have it have fun learning see you next time am open to comments and views.

Be the First to Respond

Share Your Thoughts

  • Hot
  • Active