Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Challenge 1 source
defmodule Greeter do
@author "Mark"
def start do
name = IO.gets("Hi there! What's your name?\n") |> String.trim
if name == @author do
"Wow! #{@author} is my favorite name. I was programmed by someone named #{@author}!"
else
"Hi, #{name}. It's nice to meet you."
end
end
end
defmodule Greeter do
def start do
name = IO.gets("Hi there! What's your name?\n")
case String.trim(name) do
"Mark" -> "Wow! Mark is my favorite name. I was programmed by someone named Mark!"
name -> "Hi, #{name}. It's nice to meet you."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment