Hello world not working

Hello. I’ve been attempting to get this basic hello world to display it’s output.

defmodule MN do
  def hello do
    IO.puts "Hello World"
  end
end

When I attempt to run it from the command line via the command

elixir test.exs

I just get another input prompt with no output.

2 Likes

Welcome to the forum!

You’ve defined MN.hello/0 but you haven’t invoked it.

Try adding a call to MN.hello to the end of your script, e.g.:

defmodule MN do
  def hello do
    IO.puts "Hello World"
  end
end

MN.hello
9 Likes

Ok. Thank you!

1 Like