logo image

Erlang Hello World! 

Erlang Hello World! 

   
   

Output:

Click on RUN button to see the output

Erlang Online Compiler

Write, Run & Share Erlang code online using OneCompiler's Erlang online compiler for free. It's one of the robust, feature-rich online compilers for Erlang language, running on the latest version 21. Getting started with the OneCompiler's Erlang compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Erlang. OneCompiler also has reference programs, where you can look for the sample programs and start learning. Happy learning!!

About Erlang

Erlang is a special niche functional programming language by Ericcson and first appeared in the year 1986. Many Big companies are using Erlang like Whatsapp, Facebook, Amazon, RabbitMQ and many others and ofcourse Ericsson.

Key Features

  • Open source
  • Mini operating system with a number of interesting features
  • Initially designed as phone language but later it's used in variety of applications.
  • Largely parallel and distributed
  • updates can be made with no downtime at all
  • Super clean error handling model
  • Automatic application migration.

Syntax help

Variables

Variables syntax is as follows

variable-name = value

Data types

Data typeUsageDescription
Numericstart() -> io:fwrite("~w",[10+10])Erlang supports both integer and float values.
Atomstart() -> io:fwrite(true)Atoms should start with lower case leters and can contain lowercase and uppercase characters, numbers, _ and @. You can also put atom in single quotes
Booleanstart() -> io:fwrite(10 =< 8)Output will be either true or false based on the values given
Bit Stringstr = <<10,20>>Strings are enclosed in << >> and are used to store untyped memory
Lists[1,2,3]Lists is a compound data type with Variable number of elements.
Tuplest = {apple, 100, {orange,50}}Tuple is a compound data type with fixed number of elements.
Mapmap = #{name=>onecompiler,message=>Learning}Map is a compound data type with a variable number of key-value pairs

Loops

1. If-Else:

If the condition is true then true-statement will get executed else false-statement.

if
condition ->
   true-statement;
true ->
   false-statement
end.

2. Case:

If the value is equal to any of the values(value1,value2,..Valuen) then corresponding statements will get executed.

case value of
   value1 -> statement1;
   value2 -> statement2;
   valuen -> statementn
end.

Note:

As Erlang is a functional programming language, there are no direct constructs for while, for and other loops. Recursion is the technique followed to implement loops in Erlang.

Help us with your feedback!

Reference Programs:

Erlang

No tags available for Erlang

How to use?

Choose the language in which you want to run your program, by clicking the button next to Run. And then write your code in the code box, You can use the auto complete snippets and warnings and errors which helps you to write better code faster way.
Once you are done writing your code click the Run button, now the code will be submitted to OneCompiler and you will see the results in a second.

How to contribute?

Please fork OneCompiler repository and contribute us by adding more languages or the features to the existing OneCompiler backend.
You can also contibute to the community by adding more programs which users can search and use as base code for their programs.

API & More

You can embed OneCompiler into your own website. That helps your website users to write and test their programs within your website.
If you want to run and see the results from your backend you can utilize the OneCompiler API by integrating it with your backend.