-
-
Save Qqwy/0832e24e1a8b7e628773cfeda3df0f02 to your computer and use it in GitHub Desktop.
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 Bob do | |
def hey(input) do | |
cond do | |
String.strip(input) == "" -> "Fine. Be that way!" | |
String.ends_with?(input, "?") -> "Sure." | |
all_letters_uppercase?(input) -> "Whoa, chill out!" | |
true -> "Whatever." | |
end | |
end | |
defp all_letters_uppercase?(input) do | |
String.upcase(input) == input | |
&& (String.downcase(input) != input) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment