Challenge 1 source
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 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 |
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 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