Skip to content

Instantly share code, notes, and snippets.

@samuelralak
Last active March 25, 2023 20:29
Show Gist options
  • Save samuelralak/88ba2751a2c2d4eddb7ff7d36ab1df6a to your computer and use it in GitHub Desktop.
Save samuelralak/88ba2751a2c2d4eddb7ff7d36ab1df6a to your computer and use it in GitHub Desktop.
HackerRank 30 days of code. Day 0: Hello, World. Read from STDIN in Elixir
defmodule Solution do
#Enter your code here. Read input from STDIN. Print output to STDOUT
def read do
case IO.read(:stdio, :line) do
:eof -> :ok
{:error, reason} -> IO.puts "Error: #{reason}"
data ->
IO.write(:stdio, "Hello, World. \n")
IO.write(:stdio, data)
read()
end
end
end
Solution.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment