I know very little about the Erlang programming language. This document will go over all of my knowledge of the Erlang programming language.
This is how you make a normal Hello World program in Erlang:
-module(hello_world).
-compile(export_all).
hello() ->
io:format("hello world~n").
/!\ This example has not been tested yet, and may not work
Comments in Erlang are the same as in languages like PostScript.
Single line comments in Erlang are written like so:
%% This is a single line comment
Erlang does not support multi-line comments.
Erlang does not support the break
keyword.
A factorial can be defined like so:
fac(0) -> 1;
%% if 0, return 1, semicolon means `else`
/!\ This example has not been tested yet, and may not work
Here is an undocumented Fibonacci sequence program written in Erlang.
-module(series).
-export([fib/1]).
fib(0) -> 0;
fib(N) when N < 0 -> err_neg_val;
fib(N) when N < 3 -> 1;
fib(N) -> fib_int(N, 0, 1).
fib_int(1, _, B) -> B;
fib_int(N, A, B) -> fib_int(N-1, B, A+B).
/!\ This example has not been tested yet, and may not work
Erlang programs are defined with the -module
line at the beginning. This can be written like so:
-module(myModule)
-export(0)
myModule1():
io:format("Erlang module").
/!\ This example has not been tested yet, and may not work
-
Erlang is a language by Joe Armstrong, Robert Virding, and Mike Williams
-
Erlang is not a semicolon and curly bracket language, but it is a semicolon language
-
Erlang uses the
*.erl
file extension by default. -
Erlang also uses the
*.hrl
file extension -
Erlang originally was a proprietary language, but was later made open source
-
Erlang is used in the development of WhatsApp
-
Erlang was created in 1986
-
Erlang is not one of the top 50 programming languages (as of 2022, July 31st, it has never ranked 50 or higher on the TIOBE index, but it has ranked in the top 100) source: TIOBE index
-
Erlang is a language recognized by GitHub (as of 2022, Tuesday, August 2nd)
-
Erlang is a "let it crash" styled langaueg
-
No other knowledge of the Erlang programming language
-
I have not yet memorized the names of the developers
-
No other additional comments available
File type: Markdown document (*.md *.mkd *.mdown *.markdown)
File version: 1 (2022, Tuesday, August 2nd at 4:23 pm PST)
Line count (including blank lines and compiler line): 180
Click/tap here to expand/collapse the history for this file
Version 1 (2022, Tuesday, August 2nd at 4:23 pm PST)
Changes:
- Started the file
- Added the
title
section
- Added the
Hello World in Erlang
section
- Added the
Object Oriented Hello World in Erlang
section
- Added the
Comments in Erlang
section
- Added the
Single line comments
subsection
- Added the
Multi-line comments
subsection
- Added the
break keyword in Erlang
section
- Added the
Factorials in Erlang
section
- Added the
Fibonacci sequence in Erlang
section
- Added the
Modules in Erlang
section
- Added the
other knowledge of the Erlang programming language
section
- Added the
Additional comments
section
- Added the
file info
section
- Added the
file history
section
- No other changes in version 1