Last active
March 25, 2023 20:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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