Permalink
Browse files

refactor: return fixed symbols

  • Loading branch information...
antonydenyer committed Nov 16, 2017
1 parent e75fd6c commit 358fadebaaab2514bf04cc8b10f2e0971b20f13e
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/roman.ex
View
@@ -79,23 +79,23 @@ defmodule Roman do
to_roman(number - 5, roman_accumulator <> "V")
end
def to_roman(number, roman_accumulator) when number >= 4 do
to_roman(number - 4, roman_accumulator <> "IV")
def to_roman(number, roman_accumulator) when number == 4 do
roman_accumulator <> "IV"
end
def to_roman(number, roman_accumulator) when number >= 3 do
to_roman(number - 3, roman_accumulator <> "III")
def to_roman(number, roman_accumulator) when number == 3 do
roman_accumulator <> "III"
end
def to_roman(number, roman_accumulator) when number >= 2 do
to_roman(number - 2, roman_accumulator <> "II")
def to_roman(number, roman_accumulator) when number == 2 do
roman_accumulator <> "II"
end
def to_roman(number, roman_accumulator) when number >= 1 do
def to_roman(number, roman_accumulator) when number == 1 do
roman_accumulator <> "I"
end
def to_roman(number, roman_accumulator) when number >= 0 do
def to_roman(number, roman_accumulator) when number == 0 do
roman_accumulator
end

0 comments on commit 358fade

Please sign in to comment.