Last active
April 14, 2016 04:09
-
-
Save joeljuca/1fcde330a2b0f5cf869b96409e61e55f 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
number_one = IO.gets "Please provide the first number: " | |
number_two = IO.gets "Please provide the second number: " | |
operation = IO.gets "Inform which operation you would like to do (+, -, *, /): " | |
number_one = number_one |> String.slice(0..-2) |> String.to_integer | |
number_two = number_two |> String.slice(0..-2) |> String.to_integer | |
operation = operation |> String.slice(0..-2) | |
# IO.puts number_one | |
# IO.puts number_two | |
# IO.puts operation | |
result = case operation do | |
"+" -> | |
number_one + number_two | |
"-" -> | |
number_one - number_two | |
"*" -> | |
number_one * number_two | |
"/" -> | |
number_one / number_two | |
_ -> | |
"Unsupported operand!" | |
end | |
IO.puts result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment