defmodule HW do @moduledoc """ A very minor module to support hello world Ironically complex as there are 4 versions of hello world here """ @doc """ a basic function to print hello world ... """ def hw do IO.puts "Hello World 2" end @doc """ As with the previous function, but using a special syntax to go on a single line """ def hw2, do: IO.puts("hello World 2b") @doc """ Prints command line arguements using the each function """ def hw_args do Enum.each(System.argv, fn(ele) -> IO.puts("Hello World args #{ele}") end) end @doc """ As with the previous function, but using a special syntax to write one line anonymous functions """ def hw_args2 do Enum.each(System.argv, &(IO.puts("Hello World2 args #{&1}") )) end end HW.hw_args2