elixir hello world
To write a "Hello, World!" program in Elixir, you can use the IO.puts/1
function to output a string to the console. Here's an example:
defmodule HelloWorld do
def hello do
IO.puts("Hello, World!")
end
end
HelloWorld.hello()
In this example, we define a module called HelloWorld
and a function called hello
. Inside the hello
function, we use IO.puts
to print the string "Hello, World!" to the console. Finally, we call the hello
function to execute the program.
When you run this code, it will output "Hello, World!" to the console. This is a basic example demonstrating how to print a simple message using Elixir.