Hello World in Elixir

From Elixir Wiki
Jump to navigation Jump to search

Hello World in Elixir

Hello World programs are traditionally used to introduce beginners to a programming language. In Elixir, creating a Hello World program is simple.

Example program:


  1. A Hello World program in Elixir

IO.puts("Hello, World!") ```

The above program uses the `IO.puts/1` function to output the string "Hello, World!" to the console. `IO` is a module in the Elixir standard library that provides I/O operations.

To run the program, save it with a .exs extension (e.g., hello.exs) and execute it using the Elixir compiler:

``` $ elixir hello.exs ```

The output will be:

``` Hello, World! ```


The program starts with a comment that describes what the program does. Comments in Elixir start with the `#` character.

The `IO.puts/1` function is used to print the string "Hello, World!" to the console. The `puts` function stands for "put string" and the `/1` indicates that it takes one argument.

To run the program, the Elixir compiler (`elixir`) is used along with the filename of the program (`hello.exs`). The `.exs` extension is used for Elixir script files.

Following the execution of the program, the string "Hello, World!" is displayed on the console.

See also:


[link-to-reference1 Title of Reference 1]

[link-to-reference2 Title of Reference 2]