How to write a "Hello World" program in Elixr

Elixir is a programming language that was created using Erlang and runs on the Erlang virtual machine BEAM.

To write a “Hello World” program in Elixr, create a file named helloworld.exs. Next, paste the following code into it:

IO.puts("Hello, World!")

Then, from the command line, type the following command to execute the Elixir source file:

elixir helloworld.exs

This will print “Hello World” on the screen.

Explanation

The puts function prints a message and adds a newline character at its end. Another variant is write, which does the same thing but doesn’t append a newline character. Both functions belong to the IO module, which has several functions to handle input and output.

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved